j

    Jose Carlos Hernandez

    1 month ago
    Hi guy I’have been struggling with the
    kswift
    integration and can’t compile on iOS getting this error
    error: cannot find 'LoginViewModelActionKs' in scope
                let actionKs = LoginViewModelActionKs(action)
    could you please help me? (I add detail on thread)
    here are my files: root build.gradle.kts
    buildscript {
        repositories {
            gradlePluginPortal()
            google()
            mavenCentral()
        }
        dependencies {
            classpath(libs.kotlin)
            classpath("com.android.tools.build:gradle:7.1.3")
            classpath("dev.icerock.moko:kswift-gradle-plugin:0.5.0")
        }
    }
    
    allprojects {
        repositories {
            google()
            mavenCentral()
        }
    }
    
    tasks.register("clean", Delete::class) {
        delete(rootProject.buildDir)
    }
    shared build.gradle.kts :
    plugins {
        kotlin("multiplatform")
        kotlin("native.cocoapods")
        id("com.android.library")
        id("dev.icerock.moko.kswift")
    }
    
    version = "1.0"
    val mokoMvvmVersion = "0.13.0"
    
    kotlin {
       ///....
    
        cocoapods {
            summary = "Some description for the Shared Module"
            homepage = "Link to the Shared Module homepage"
            ios.deploymentTarget = "15.5"
            podfile = project.file("../iosApp/Podfile")
            framework {
                baseName = "MultiPlatformLibrary"
                isStatic = false
                export("dev.icerock.moko:mvvm-core:$mokoMvvmVersion")
                export("dev.icerock.moko:mvvm-flow:$mokoMvvmVersion")
            }
        }
        
        sourceSets {
            val commonMain by getting {
                dependencies {
                    ///....
                    api("dev.icerock.moko:mvvm-core:$mokoMvvmVersion")
                    api("dev.icerock.moko:mvvm-flow:$mokoMvvmVersion")
                }
            }
            val commonTest by getting {
                dependencies {
                    implementation(kotlin("test"))
                }
            }
            val androidMain by getting {
                dependencies {
                    implementation(libs.moko.mvvm.flow.compose)
                }
            }
            //....
        }
    }
    
    android {
        compileSdk = 32
        sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
        defaultConfig {
            minSdk = 21
            targetSdk = 32
        }
    }
    kswift {
        install(dev.icerock.moko.kswift.plugin.feature.SealedToSwiftEnumFeature)
    }
    podFile:
    target 'iosApp' do
      use_frameworks!
      platform :ios, '15.5'
      pod 'kmm_library', :path => '../kmm_library'
      pod 'mokoMvvmFlowSwiftUI', :podspec => '<https://raw.githubusercontent.com/icerockdev/moko-mvvm/release/0.13.0/mokoMvvmFlowSwiftUI.podspec>'
    end