hey guys, by any chance someone could help me with...
# moko
a
hey guys, by any chance someone could help me with setting up project that uses mokoMvvmFlowSwiftUI and firebase from https://github.com/GitLiveApp/firebase-kotlin-sdk. Issue is that when setting up pods for firebase it is not working as dynamic framework (has to be
isStatic = true
) otherwise getting framework not found errors while building ios, but then mokoMvvmFlowSwiftUI lib crashes ios runtime with “*Library not loaded: @rpath/MultiPlatformLibrary.framework/MultiPlatformLibrary”* Maybe it is possible to use static libraries optionally? here is cocoapods setup from gradle file:
Copy code
cocoapods {
        summary = "Some description for the Shared Module"
        homepage = "Link to the Shared Module homepage"
        ios.deploymentTarget = "15.0"
        podfile = project.file("../iosApp/Podfile")
        framework {
            baseName = "MultiPlatformLibrary"
//            isStatic = false

            export("dev.icerock.moko:mvvm-core:$mokoMvvmVersion")
            export("dev.icerock.moko:mvvm-flow:$mokoMvvmVersion")
        }
    }
basically I am struggling to add firebase from here https://github.com/GitLiveApp/firebase-kotlin-sdk to this project https://github.com/Alex009/moko-mvvm-compose-swiftui On Android it works perfectly, but iOS builds successfully and crashes on runtime Thanks for any help!
a
you can't use dynamic
mokoMvvmFlowSwiftUI
framework with static kotlin framework. in this case you can only copy-paste all sources of
mokoMvvmFlowSwiftUI
from here to your swift project
a
Thanks, got it working!
but on example project it is there
a
where you search generated files?
a
but on fresh project they are not being generated, even tried to use exactly the same gradle files from sample project, maybe I am missing something in XCode setup?
here is how shared module gradle looks
Copy code
import org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType

plugins {
    kotlin("plugin.serialization") version "1.7.10"
    kotlin("multiplatform")
    kotlin("native.cocoapods")
    id("com.android.library")
    id("kotlin-parcelize")
    id("dev.icerock.moko.kswift")
}

version = "1.0"

kotlin {
    android()
    iosX64()
    iosArm64()
    iosSimulatorArm64()

    cocoapods {
        summary = "Some description for the Shared Module"
        homepage = "Link to the Shared Module homepage"
        ios.deploymentTarget = "15.0"
        podfile = project.file("../ios/Podfile")

        pod("FirebaseAuth")
        pod("FirebaseCore")

        framework {
            baseName = "MultiPlatformLibrary"
            isStatic = false
            transitiveExport = false // This is default.

            export("dev.icerock.moko:mvvm-core:0.13.1")
            export("dev.icerock.moko:mvvm-flow:0.13.1")

            // Maps custom Xcode configuration to NativeBuildType
            xcodeConfigurationToNativeBuildType["CUSTOM_DEBUG"] = NativeBuildType.DEBUG
            xcodeConfigurationToNativeBuildType["CUSTOM_RELEASE"] = NativeBuildType.RELEASE

        }
    }

    tasks.withType(org.jetbrains.kotlin.gradle.tasks.CInteropProcess::class.java) {
        settings.compilerOpts += listOf("-DNS_FORMAT_ARGUMENT(A)=", "-D_Nullable_result=_Nullable")
    }

    sourceSets {
        val commonMain by getting {
            dependencies {
                api(project(":firebase-auth"))

                implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.4.0")
                implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.0")
                implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.4.0")

                // Mokko
                api("dev.icerock.moko:mvvm-core:0.13.1") // only ViewModel, EventsDispatcher, Dispatchers.UI
                api("dev.icerock.moko:mvvm-livedata:0.13.1") // api mvvm-core, LiveData and extensions
                api("dev.icerock.moko:mvvm-livedata-resources:0.13.1") // api mvvm-core, moko-resources, extensions for LiveData with moko-resources }
                api("dev.icerock.moko:mvvm-state:0.13.1") // api mvvm-livedata, ResourceState class and extensions
                api("dev.icerock.moko:mvvm-flow:0.13.1") // api mvvm-core, CFlow for native and binding extensions
                implementation("dev.icerock.moko:parcelize:0.8.0")
                api("dev.icerock.moko:kswift-runtime:0.6.0")

                // RX
                implementation("com.badoo.reaktive:reaktive:1.2.2")
                implementation("com.badoo.reaktive:reaktive-annotations:1.2.2")
                implementation("com.badoo.reaktive:coroutines-interop:1.2.2") // For interop with coroutines
            }
        }
        val commonTest by getting {
            dependencies {
                implementation(kotlin("test"))
                implementation("dev.icerock.moko:mvvm-test:0.13.1")
                implementation("com.badoo.reaktive:reaktive-testing:1.2.2")
            }
        }
        val androidMain by getting {
            dependencies {
                implementation("dev.icerock.moko:mvvm-flow-compose:0.13.1") // api mvvm-flow, binding extensions for Jetpack Compose (jvm, js, android)
                implementation("dev.icerock.moko:mvvm-livedata-compose:0.13.1") // api mvvm-livedata, binding extensions for Jetpack Compose (jvm, js, android)
                implementation("dev.icerock.moko:mvvm-livedata-material:0.13.1") // api mvvm-livedata, Material library android extensions
                implementation("dev.icerock.moko:mvvm-livedata-glide:0.13.1") // api mvvm-livedata, Glide library android extensions
                implementation("dev.icerock.moko:mvvm-livedata-swiperefresh:0.13.1") // api mvvm-livedata, SwipeRefreshLayout library android extensions
                implementation("dev.icerock.moko:mvvm-databinding:0.13.1") // api mvvm-livedata, DataBinding support for Android
                implementation("dev.icerock.moko:mvvm-viewbinding:0.13.1") // api mvvm-livedata, ViewBinding support for Android
            }
        }
        val androidTest by getting
        val iosX64Main by getting
        val iosArm64Main by getting
        val iosSimulatorArm64Main by getting
        val iosMain by creating {
            dependsOn(commonMain)
            iosX64Main.dependsOn(this)
            iosArm64Main.dependsOn(this)
            iosSimulatorArm64Main.dependsOn(this)
        }
        val iosX64Test by getting
        val iosArm64Test by getting
        val iosSimulatorArm64Test by getting
        val iosTest by creating {
            dependsOn(commonTest)
            iosX64Test.dependsOn(this)
            iosArm64Test.dependsOn(this)
            iosSimulatorArm64Test.dependsOn(this)
        }
    }
}

android {
    compileSdk = 32
    sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
    defaultConfig {
        minSdk = 21
        targetSdk = 32
    }
}

kswift {
    iosDeploymentTarget.set("11.0")
    install(dev.icerock.moko.kswift.plugin.feature.SealedToSwiftEnumFeature)
}
manage to make it work with manually linking files