Wie Kottie:
- Ich habe Lottie.xcframework von https://github.com/airbnb/lottie-ios/releases heruntergeladen
- Ich habe einen Dateinamen hinzugefügt Lottie.def in einem Ordner namens cinterop in iosMain
- In build.gradle habe ich diesen Code hinzugefügt:
Code: Select all
iosArm64 {
compilations.getByName("main") {
val Lottie by cinterops.creating {
defFile("src/iosMain/cinterop/Lottie.def")
val path = "$rootDir/libs/Lottie.xcframework/ios-arm64"
compilerOpts("-F$path", "-framework", "Lottie", "-rpath", path)
extraOpts += listOf("-compiler-option", "-fmodules")
}
}
}
listOf(
iosX64(),
iosSimulatorArm64()
).forEach {
it.compilations.getByName("main") {
val Lottie by cinterops.creating {
defFile("src/iosMain/cinterop/Lottie.def")
val path = "$rootDir/libs/Lottie.xcframework/ios-arm64_x86_64-simulator"
compilerOpts("-F$path", "-framework", "Lottie", "-rpath", path)
extraOpts += listOf("-compiler-option", "-fmodules")
}
}
}
Code: Select all
import lottie.*
@Composable
actual fun LottieAnimation(
modifier: Modifier,
composition: Any?,
progress: () -> Float,
backgroundColor: Color,
contentScale: ContentScale,
clipToCompositionBounds: Boolean,
) {
}
Hinweis: Ich habe Lottie.xcframework in Frameworks, Bibliotheken und eingebetteten Inhalten in Xcode hinzugefügt und seine Einbettung ist Embed Sign
Vielen Dank im Voraus für Ihre Anleitung
Mobile version