Open RageshAntony opened 1 year ago
try this steps:
./gradlew clean
build/cocoapods
pod install
- at this step cocoapods will see generated sources and successful add this files to pods projecttry this steps:
./gradlew clean
- Run build from xcode (at this step build can failed). gradle should execute syncFramework task, that should execute link** task to create framework and kswift will create swift files with framework. then syncFramework task will move framework and kswift files to directory
build/cocoapods
- run
pod install
- at this step cocoapods will see generated sources and successful add this files to pods project- run build again - at this step build should be successful
Still same
I executed ./gradlew clean command and went to xcode and then executed "clean build folder" and then "build"
Then executed "pod install"
Then executed "Rebuild project" in studio
Still Ks Files not generated ?
I am having the same issue.
I have got a very simple sealed class like below which is located in shared/src/commonMain/kotlin/com/..
sealed class ResultType<out T : Any> {
data class Success<out T : Any>(val value: T) : ResultType<T>()
data class Error(val message: String, val cause: Exception? = null) : ResultType<Nothing>()
}
also tried with an interface, it's still the same:
sealed interface ResultType<out T : Any> {
data class Success<out T : Any>(val value: T) : ResultType<T>
data class Error(val message: String, val cause: Exception? = null) : ResultType<Nothing>
}
Implementation: shared - build.gradle.kts
plugins {
kotlin("multiplatform")
kotlin("native.cocoapods")
kotlin("plugin.serialization") version "1.6.10"
id("com.android.library")
id("dev.icerock.moko.kswift") version "0.6.0"
}
kswift {
install(dev.icerock.moko.kswift.plugin.feature.SealedToSwiftEnumFeature)
}
I am having the same issue.
I have got a very simple sealed class like below which is located in shared/src/commonMain/kotlin/com/..
sealed class ResultType<out T : Any> { data class Success<out T : Any>(val value: T) : ResultType<T>() data class Error(val message: String, val cause: Exception? = null) : ResultType<Nothing>() }
also tried with an interface, it's still the same:
sealed interface ResultType<out T : Any> { data class Success<out T : Any>(val value: T) : ResultType<T> data class Error(val message: String, val cause: Exception? = null) : ResultType<Nothing> }
Implementation: shared - build.gradle.kts
plugins { kotlin("multiplatform") kotlin("native.cocoapods") kotlin("plugin.serialization") version "1.6.10" id("com.android.library") id("dev.icerock.moko.kswift") version "0.6.0" } kswift { install(dev.icerock.moko.kswift.plugin.feature.SealedToSwiftEnumFeature) }
@burakeregar
Please refer this link
https://github.com/Alex009/moko-mvvm-compose-swiftui/issues/2#issuecomment-1216170718
Fixed it
My workaround
import org.jetbrains.kotlin.gradle.plugin.mpp.Framework
import org.jetbrains.kotlin.gradle.tasks.KotlinNativeLink
tasks.withType<KotlinNativeLink>()
.matching { it.binary is Framework }
.configureEach {
doLast {
val kSwiftGeneratedDir = destinationDirectory.get()
.dir("${binary.baseName}Swift")
.asFile
val kSwiftPodSourceDir = buildDir
.resolve("cocoapods")
.resolve("framework")
.resolve("${binary.baseName}Swift")
kSwiftGeneratedDir.copyRecursively(kSwiftPodSourceDir, overwrite = true)
println("[COPIED] $kSwiftGeneratedDir -> $kSwiftPodSourceDir")
}
}
Why LoginViewModelActionKs is not generated ? I am getting
Cannot find 'LoginViewModelActionKs' in scope
I added everything in the gradle . But still no Ks classes generated .
My gradle files:
project gradle
shared module gradle
please help me