Verwenden Sie Lottie im CMP-ProjektIOS

Programmierung für iOS
Anonymous
 Verwenden Sie Lottie im CMP-Projekt

Post by Anonymous »

Ich möchte Lottie zu meinem CMP-Projekt für iOS hinzufügen, aber Ich möchte keine Bibliothek wie Kottie in meinem Projekt verwenden und möchte es von der Basis aus implementieren.
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")
}
}
}
aber als ich diese Compose-Funktion erstellt habe und Lottie verwenden möchte, wird sie nicht importiert

Code: Select all

import lottie.*

@Composable
actual fun LottieAnimation(
modifier: Modifier,
composition: Any?,
progress: () -> Float,
backgroundColor: Color,
contentScale: ContentScale,
clipToCompositionBounds: Boolean,
) {
}
Das Problem besteht darin, dass es Lottie nicht versteht: Ungelöste Referenz „Lottie“.
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

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post