diff --git a/Sources/DotLottie/Public/DotLottieAnimation.swift b/Sources/DotLottie/Public/DotLottieAnimation.swift
index c3c0dce..a1d4b58 100644
--- a/Sources/DotLottie/Public/DotLottieAnimation.swift
+++ b/Sources/DotLottie/Public/DotLottieAnimation.swift
@@ -34,7 +34,9 @@ public class DotLottieAnimation: ObservableObject {
speed: config.speed ?? 1.0,
useFrameInterpolation: config.useFrameInterpolation ?? false,
segments: config.segments != nil ? [config.segments!.0, config.segments!.1] : [],
- backgroundColor: 0, marker: config.marker ?? "")
+ backgroundColor: 0,
+ layout: config.layout ?? createDefaultLayout(),
+ marker: config.marker ?? "")
self.player = Player(config: self.config)
diff --git a/Sources/DotLottie/Public/Models/AnimationConfig.swift b/Sources/DotLottie/Public/Models/AnimationConfig.swift
index b6cdf10..8b317ab 100644
--- a/Sources/DotLottie/Public/Models/AnimationConfig.swift
+++ b/Sources/DotLottie/Public/Models/AnimationConfig.swift
@@ -18,6 +18,7 @@ public struct AnimationConfig {
public var backgroundColor: CIImage? = .clear
public var width: Int? = 512
public var height: Int? = 512
+ public var layout: Layout? = createDefaultLayout()
public var marker: String? = ""
public init(
@@ -30,6 +31,7 @@ public struct AnimationConfig {
backgroundColor: CIImage? = .clear,
width: Int? = nil,
height: Int? = nil,
+ layout: Layout? = createDefaultLayout(),
marker: String? = nil
) {
self.autoplay = autoplay
@@ -41,6 +43,7 @@ public struct AnimationConfig {
self.backgroundColor = backgroundColor
self.width = width
self.height = height
+ self.layout = layout
self.marker = marker
}
}
diff --git a/Sources/DotLottie/Public/dotlottie_player.swift b/Sources/DotLottie/Public/dotlottie_player.swift
index 0ead9f6..1f87515 100644
--- a/Sources/DotLottie/Public/dotlottie_player.swift
+++ b/Sources/DotLottie/Public/dotlottie_player.swift
@@ -1303,6 +1303,7 @@ public struct Config {
public var useFrameInterpolation: Bool
public var segments: [Float]
public var backgroundColor: UInt32
+ public var layout: Layout
public var marker: String
// Default memberwise initializers are never public by default, so we
@@ -1315,6 +1316,7 @@ public struct Config {
useFrameInterpolation: Bool,
segments: [Float],
backgroundColor: UInt32,
+ layout: Layout,
marker: String
) {
self.autoplay = autoplay
@@ -1324,6 +1326,7 @@ public struct Config {
self.useFrameInterpolation = useFrameInterpolation
self.segments = segments
self.backgroundColor = backgroundColor
+ self.layout = layout
self.marker = marker
}
}
@@ -1351,6 +1354,9 @@ extension Config: Equatable, Hashable {
if lhs.backgroundColor != rhs.backgroundColor {
return false
}
+ if lhs.layout != rhs.layout {
+ return false
+ }
if lhs.marker != rhs.marker {
return false
}
@@ -1365,6 +1371,7 @@ extension Config: Equatable, Hashable {
hasher.combine(useFrameInterpolation)
hasher.combine(segments)
hasher.combine(backgroundColor)
+ hasher.combine(layout)
hasher.combine(marker)
}
}
@@ -1380,6 +1387,7 @@ public struct FfiConverterTypeConfig: FfiConverterRustBuffer {
useFrameInterpolation: FfiConverterBool.read(from: &buf),
segments: FfiConverterSequenceFloat.read(from: &buf),
backgroundColor: FfiConverterUInt32.read(from: &buf),
+ layout: FfiConverterTypeLayout.read(from: &buf),
marker: FfiConverterString.read(from: &buf)
)
}
@@ -1392,6 +1400,7 @@ public struct FfiConverterTypeConfig: FfiConverterRustBuffer {
FfiConverterBool.write(value.useFrameInterpolation, into: &buf)
FfiConverterSequenceFloat.write(value.segments, into: &buf)
FfiConverterUInt32.write(value.backgroundColor, into: &buf)
+ FfiConverterTypeLayout.write(value.layout, into: &buf)
FfiConverterString.write(value.marker, into: &buf)
}
}
@@ -1404,6 +1413,61 @@ public func FfiConverterTypeConfig_lower(_ value: Config) -> RustBuffer {
return FfiConverterTypeConfig.lower(value)
}
+public struct Layout {
+ public var fit: Fit
+ public var align: [Float]
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(
+ fit: Fit,
+ align: [Float]
+ ) {
+ self.fit = fit
+ self.align = align
+ }
+}
+
+extension Layout: Equatable, Hashable {
+ public static func == (lhs: Layout, rhs: Layout) -> Bool {
+ if lhs.fit != rhs.fit {
+ return false
+ }
+ if lhs.align != rhs.align {
+ return false
+ }
+ return true
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(fit)
+ hasher.combine(align)
+ }
+}
+
+public struct FfiConverterTypeLayout: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Layout {
+ return
+ try Layout(
+ fit: FfiConverterTypeFit.read(from: &buf),
+ align: FfiConverterSequenceFloat.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: Layout, into buf: inout [UInt8]) {
+ FfiConverterTypeFit.write(value.fit, into: &buf)
+ FfiConverterSequenceFloat.write(value.align, into: &buf)
+ }
+}
+
+public func FfiConverterTypeLayout_lift(_ buf: RustBuffer) throws -> Layout {
+ return try FfiConverterTypeLayout.lift(buf)
+}
+
+public func FfiConverterTypeLayout_lower(_ value: Layout) -> RustBuffer {
+ return FfiConverterTypeLayout.lower(value)
+}
+
public struct Manifest {
public var activeAnimationId: String?
public var animations: [ManifestAnimation]
@@ -1786,6 +1850,72 @@ public func FfiConverterTypeMarker_lower(_ value: Marker) -> RustBuffer {
return FfiConverterTypeMarker.lower(value)
}
+// Note that we don't yet support `indirect` for enums.
+// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
+public enum Fit {
+ case contain
+ case fill
+ case cover
+ case fitWidth
+ case fitHeight
+ case none
+}
+
+public struct FfiConverterTypeFit: FfiConverterRustBuffer {
+ typealias SwiftType = Fit
+
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Fit {
+ let variant: Int32 = try readInt(&buf)
+ switch variant {
+ case 1: return .contain
+
+ case 2: return .fill
+
+ case 3: return .cover
+
+ case 4: return .fitWidth
+
+ case 5: return .fitHeight
+
+ case 6: return .none
+
+ default: throw UniffiInternalError.unexpectedEnumCase
+ }
+ }
+
+ public static func write(_ value: Fit, into buf: inout [UInt8]) {
+ switch value {
+ case .contain:
+ writeInt(&buf, Int32(1))
+
+ case .fill:
+ writeInt(&buf, Int32(2))
+
+ case .cover:
+ writeInt(&buf, Int32(3))
+
+ case .fitWidth:
+ writeInt(&buf, Int32(4))
+
+ case .fitHeight:
+ writeInt(&buf, Int32(5))
+
+ case .none:
+ writeInt(&buf, Int32(6))
+ }
+ }
+}
+
+public func FfiConverterTypeFit_lift(_ buf: RustBuffer) throws -> Fit {
+ return try FfiConverterTypeFit.lift(buf)
+}
+
+public func FfiConverterTypeFit_lower(_ value: Fit) -> RustBuffer {
+ return FfiConverterTypeFit.lower(value)
+}
+
+extension Fit: Equatable, Hashable {}
+
// Note that we don't yet support `indirect` for enums.
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
public enum Mode {
@@ -2097,6 +2227,14 @@ private struct FfiConverterSequenceTypeMarker: FfiConverterRustBuffer {
}
}
+public func createDefaultLayout() -> Layout {
+ return try! FfiConverterTypeLayout.lift(
+ try! rustCall {
+ uniffi_dotlottie_player_fn_func_create_default_layout($0)
+ }
+ )
+}
+
private enum InitializationResult {
case ok
case contractVersionMismatch
@@ -2113,6 +2251,9 @@ private var initializationResult: InitializationResult {
if bindings_contract_version != scaffolding_contract_version {
return InitializationResult.contractVersionMismatch
}
+ if uniffi_dotlottie_player_checksum_func_create_default_layout() != 41529 {
+ return InitializationResult.apiChecksumMismatch
+ }
if uniffi_dotlottie_player_checksum_method_dotlottieplayer_buffer_len() != 33793 {
return InitializationResult.apiChecksumMismatch
}
diff --git a/Sources/DotLottieCore/DotLottiePlayer.xcframework/Info.plist b/Sources/DotLottieCore/DotLottiePlayer.xcframework/Info.plist
index 2025d30..cddec4e 100644
--- a/Sources/DotLottieCore/DotLottiePlayer.xcframework/Info.plist
+++ b/Sources/DotLottieCore/DotLottiePlayer.xcframework/Info.plist
@@ -8,7 +8,7 @@
BinaryPath
DotLottiePlayer.framework/DotLottiePlayer
LibraryIdentifier
- ios-arm64_x86_64-simulator
+ macos-arm64_x86_64
LibraryPath
DotLottiePlayer.framework
SupportedArchitectures
@@ -17,15 +17,13 @@
x86_64
SupportedPlatform
- ios
- SupportedPlatformVariant
- simulator
+ macos
BinaryPath
DotLottiePlayer.framework/DotLottiePlayer
LibraryIdentifier
- macos-arm64_x86_64
+ ios-arm64_x86_64-simulator
LibraryPath
DotLottiePlayer.framework
SupportedArchitectures
@@ -34,7 +32,9 @@
x86_64
SupportedPlatform
- macos
+ ios
+ SupportedPlatformVariant
+ simulator
BinaryPath
diff --git a/Sources/DotLottieCore/DotLottiePlayer.xcframework/ios-arm64/DotLottiePlayer.framework/DotLottiePlayer b/Sources/DotLottieCore/DotLottiePlayer.xcframework/ios-arm64/DotLottiePlayer.framework/DotLottiePlayer
index 01cbbc1..062e8b5 100755
Binary files a/Sources/DotLottieCore/DotLottiePlayer.xcframework/ios-arm64/DotLottiePlayer.framework/DotLottiePlayer and b/Sources/DotLottieCore/DotLottiePlayer.xcframework/ios-arm64/DotLottiePlayer.framework/DotLottiePlayer differ
diff --git a/Sources/DotLottieCore/DotLottiePlayer.xcframework/ios-arm64/DotLottiePlayer.framework/Headers/dotlottie_player.h b/Sources/DotLottieCore/DotLottiePlayer.xcframework/ios-arm64/DotLottiePlayer.framework/Headers/dotlottie_player.h
index 1af8b2d..8f84243 100644
--- a/Sources/DotLottieCore/DotLottiePlayer.xcframework/ios-arm64/DotLottiePlayer.framework/Headers/dotlottie_player.h
+++ b/Sources/DotLottieCore/DotLottiePlayer.xcframework/ios-arm64/DotLottiePlayer.framework/Headers/dotlottie_player.h
@@ -146,6 +146,9 @@ void uniffi_dotlottie_player_fn_method_observer_on_play(void*_Nonnull ptr, RustC
void uniffi_dotlottie_player_fn_method_observer_on_render(void*_Nonnull ptr, float frame_no, RustCallStatus *_Nonnull out_status
);
void uniffi_dotlottie_player_fn_method_observer_on_stop(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
+);
+RustBuffer uniffi_dotlottie_player_fn_func_create_default_layout(RustCallStatus *_Nonnull out_status
+
);
RustBuffer ffi_dotlottie_player_rustbuffer_alloc(int32_t size, RustCallStatus *_Nonnull out_status
);
@@ -258,6 +261,9 @@ void ffi_dotlottie_player_rust_future_cancel_void(void* _Nonnull handle
void ffi_dotlottie_player_rust_future_free_void(void* _Nonnull handle
);
void ffi_dotlottie_player_rust_future_complete_void(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
+);
+uint16_t uniffi_dotlottie_player_checksum_func_create_default_layout(void
+
);
uint16_t uniffi_dotlottie_player_checksum_method_dotlottieplayer_buffer_len(void
diff --git a/Sources/DotLottieCore/DotLottiePlayer.xcframework/ios-arm64_x86_64-simulator/DotLottiePlayer.framework/DotLottiePlayer b/Sources/DotLottieCore/DotLottiePlayer.xcframework/ios-arm64_x86_64-simulator/DotLottiePlayer.framework/DotLottiePlayer
index 47e0611..772de1b 100755
Binary files a/Sources/DotLottieCore/DotLottiePlayer.xcframework/ios-arm64_x86_64-simulator/DotLottiePlayer.framework/DotLottiePlayer and b/Sources/DotLottieCore/DotLottiePlayer.xcframework/ios-arm64_x86_64-simulator/DotLottiePlayer.framework/DotLottiePlayer differ
diff --git a/Sources/DotLottieCore/DotLottiePlayer.xcframework/ios-arm64_x86_64-simulator/DotLottiePlayer.framework/Headers/dotlottie_player.h b/Sources/DotLottieCore/DotLottiePlayer.xcframework/ios-arm64_x86_64-simulator/DotLottiePlayer.framework/Headers/dotlottie_player.h
index 1af8b2d..8f84243 100644
--- a/Sources/DotLottieCore/DotLottiePlayer.xcframework/ios-arm64_x86_64-simulator/DotLottiePlayer.framework/Headers/dotlottie_player.h
+++ b/Sources/DotLottieCore/DotLottiePlayer.xcframework/ios-arm64_x86_64-simulator/DotLottiePlayer.framework/Headers/dotlottie_player.h
@@ -146,6 +146,9 @@ void uniffi_dotlottie_player_fn_method_observer_on_play(void*_Nonnull ptr, RustC
void uniffi_dotlottie_player_fn_method_observer_on_render(void*_Nonnull ptr, float frame_no, RustCallStatus *_Nonnull out_status
);
void uniffi_dotlottie_player_fn_method_observer_on_stop(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
+);
+RustBuffer uniffi_dotlottie_player_fn_func_create_default_layout(RustCallStatus *_Nonnull out_status
+
);
RustBuffer ffi_dotlottie_player_rustbuffer_alloc(int32_t size, RustCallStatus *_Nonnull out_status
);
@@ -258,6 +261,9 @@ void ffi_dotlottie_player_rust_future_cancel_void(void* _Nonnull handle
void ffi_dotlottie_player_rust_future_free_void(void* _Nonnull handle
);
void ffi_dotlottie_player_rust_future_complete_void(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
+);
+uint16_t uniffi_dotlottie_player_checksum_func_create_default_layout(void
+
);
uint16_t uniffi_dotlottie_player_checksum_method_dotlottieplayer_buffer_len(void
diff --git a/Sources/DotLottieCore/DotLottiePlayer.xcframework/macos-arm64_x86_64/DotLottiePlayer.framework/DotLottiePlayer b/Sources/DotLottieCore/DotLottiePlayer.xcframework/macos-arm64_x86_64/DotLottiePlayer.framework/DotLottiePlayer
index eff8e4f..e5657c8 100755
Binary files a/Sources/DotLottieCore/DotLottiePlayer.xcframework/macos-arm64_x86_64/DotLottiePlayer.framework/DotLottiePlayer and b/Sources/DotLottieCore/DotLottiePlayer.xcframework/macos-arm64_x86_64/DotLottiePlayer.framework/DotLottiePlayer differ
diff --git a/Sources/DotLottieCore/DotLottiePlayer.xcframework/macos-arm64_x86_64/DotLottiePlayer.framework/Headers/dotlottie_player.h b/Sources/DotLottieCore/DotLottiePlayer.xcframework/macos-arm64_x86_64/DotLottiePlayer.framework/Headers/dotlottie_player.h
index 1af8b2d..8f84243 100644
--- a/Sources/DotLottieCore/DotLottiePlayer.xcframework/macos-arm64_x86_64/DotLottiePlayer.framework/Headers/dotlottie_player.h
+++ b/Sources/DotLottieCore/DotLottiePlayer.xcframework/macos-arm64_x86_64/DotLottiePlayer.framework/Headers/dotlottie_player.h
@@ -146,6 +146,9 @@ void uniffi_dotlottie_player_fn_method_observer_on_play(void*_Nonnull ptr, RustC
void uniffi_dotlottie_player_fn_method_observer_on_render(void*_Nonnull ptr, float frame_no, RustCallStatus *_Nonnull out_status
);
void uniffi_dotlottie_player_fn_method_observer_on_stop(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
+);
+RustBuffer uniffi_dotlottie_player_fn_func_create_default_layout(RustCallStatus *_Nonnull out_status
+
);
RustBuffer ffi_dotlottie_player_rustbuffer_alloc(int32_t size, RustCallStatus *_Nonnull out_status
);
@@ -258,6 +261,9 @@ void ffi_dotlottie_player_rust_future_cancel_void(void* _Nonnull handle
void ffi_dotlottie_player_rust_future_free_void(void* _Nonnull handle
);
void ffi_dotlottie_player_rust_future_complete_void(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
+);
+uint16_t uniffi_dotlottie_player_checksum_func_create_default_layout(void
+
);
uint16_t uniffi_dotlottie_player_checksum_method_dotlottieplayer_buffer_len(void