например, Kottie:
- Я скачал Lottie.xcframework с https://github.com/airbnb/lottie-ios/releases
- Я добавил имя файла Lottie.def в папке cinterop в iosMain
- В build.gradle я добавил этот код:
Код: Выделить всё
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")
}
}
}
Код: Выделить всё
import lottie.*
@Composable
actual fun LottieAnimation(
modifier: Modifier,
composition: Any?,
progress: () -> Float,
backgroundColor: Color,
contentScale: ContentScale,
clipToCompositionBounds: Boolean,
) {
}
примечание: я добавил Lottie.xcframework в Frameworks, Libraries и Embedded Content в Xcode, и его встраивание — это Embed Sign.
Заранее спасибо за ваши рекомендации.>
Подробнее здесь: https://stackoverflow.com/questions/796 ... mp-project
Мобильная версия