All Downloads are FREE. Search and download functionalities are using the official Maven repository.

iosMain.kottieComposition.KottieComposition.ios.kt Maven / Gradle / Ivy

There is a newer version: 1.9.6
Show newest version
package kottieComposition

import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import lottie.lottieComposition.LottieCompositionSpec

@Composable
actual fun kottieComposition(
    spec: KottieCompositionSpec
): Any? {
    var lottieSpec by remember {  mutableStateOf( null) }
    LaunchedEffect(spec){
        lottieSpec = when(spec){
            is KottieCompositionSpec.File -> {
                LottieCompositionSpec.File(spec.path)
            }
            is KottieCompositionSpec.Url -> {
                LottieCompositionSpec.Url(spec.url)
            }
            is KottieCompositionSpec.JsonString -> {
                LottieCompositionSpec.JsonString(spec.jsonString)
            }
        }
    }
    return    lottieSpec
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy