Skip to content

Commit

Permalink
Merge pull request #27 from LottieFiles/feat/expressions-support
Browse files Browse the repository at this point in the history
feat: updated core player for expression support
  • Loading branch information
samuelOsborne authored May 23, 2024
2 parents 0238489 + 9fce4c1 commit f350a77
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 9 deletions.
29 changes: 25 additions & 4 deletions Sources/DotLottie/Public/dotlottie_player.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1551,12 +1551,12 @@ public struct ManifestAnimation {
public var loop: Bool?
public var loopCount: UInt32?
public var playMode: String?
public var speed: UInt32?
public var speed: Float?
public var themeColor: String?

// Default memberwise initializers are never public by default, so we
// declare one manually.
public init(autoplay: Bool?, defaultTheme: String?, direction: Int8?, hover: Bool?, id: String, intermission: UInt32?, loop: Bool?, loopCount: UInt32?, playMode: String?, speed: UInt32?, themeColor: String?) {
public init(autoplay: Bool?, defaultTheme: String?, direction: Int8?, hover: Bool?, id: String, intermission: UInt32?, loop: Bool?, loopCount: UInt32?, playMode: String?, speed: Float?, themeColor: String?) {
self.autoplay = autoplay
self.defaultTheme = defaultTheme
self.direction = direction
Expand Down Expand Up @@ -1637,7 +1637,7 @@ public struct FfiConverterTypeManifestAnimation: FfiConverterRustBuffer {
loop: FfiConverterOptionBool.read(from: &buf),
loopCount: FfiConverterOptionUInt32.read(from: &buf),
playMode: FfiConverterOptionString.read(from: &buf),
speed: FfiConverterOptionUInt32.read(from: &buf),
speed: FfiConverterOptionFloat.read(from: &buf),
themeColor: FfiConverterOptionString.read(from: &buf)
)
}
Expand All @@ -1652,7 +1652,7 @@ public struct FfiConverterTypeManifestAnimation: FfiConverterRustBuffer {
FfiConverterOptionBool.write(value.loop, into: &buf)
FfiConverterOptionUInt32.write(value.loopCount, into: &buf)
FfiConverterOptionString.write(value.playMode, into: &buf)
FfiConverterOptionUInt32.write(value.speed, into: &buf)
FfiConverterOptionFloat.write(value.speed, into: &buf)
FfiConverterOptionString.write(value.themeColor, into: &buf)
}
}
Expand Down Expand Up @@ -1941,6 +1941,27 @@ private struct FfiConverterOptionUInt32: FfiConverterRustBuffer {
}
}

private struct FfiConverterOptionFloat: FfiConverterRustBuffer {
typealias SwiftType = Float?

public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
guard let value = value else {
writeInt(&buf, Int8(0))
return
}
writeInt(&buf, Int8(1))
FfiConverterFloat.write(value, into: &buf)
}

public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
switch try readInt(&buf) as Int8 {
case 0: return nil
case 1: return try FfiConverterFloat.read(from: &buf)
default: throw UniffiInternalError.unexpectedOptionalTag
}
}
}

private struct FfiConverterOptionBool: FfiConverterRustBuffer {
typealias SwiftType = Bool?

Expand Down
10 changes: 5 additions & 5 deletions Sources/DotLottieCore/DotLottiePlayer.xcframework/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,15 @@
<array>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>DotLottiePlayer.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
Expand All @@ -34,15 +31,18 @@
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>DotLottiePlayer.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
</array>
<key>CFBundlePackageType</key>
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit f350a77

Please sign in to comment.