lilypuchi
09/06/2022, 11:59 PMobject Strings {
val TitleTalks = "Talks"
val TabTalks = "Talks"
val TabChannels = "Channel"
val TabProfile = "Profile"
}
complete build.gradle looks like this
plugins {
kotlin("multiplatform")
id("com.android.library")
id("com.chromaticnoise.multiplatform-swiftpackage") version "2.0.3"
}
kotlin {
multiplatformSwiftPackage {
swiftToolsVersion("5.3")
targetPlatforms {
iOS { v("13") }
}
packageName("AppStrings")
outputDirectory(File(projectDir, "spm/strings"))
}
android()
ios {
binaries {
framework {
baseName = "strings"
isStatic = false
}
}
}
iosSimulatorArm64 {
binaries {
framework {
baseName = "strings"
isStatic = false
}
}
}
sourceSets {
val commonMain by getting {
dependencies {
implementation(libs.moko.resources.core)
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
}
}
val androidMain by getting {
dependencies {
implementation(libs.moko.resources.compose)
}
}
val androidTest by getting
val iosMain by getting
val iosTest by getting
val iosSimulatorArm64Main by getting {
dependsOn(iosMain)
}
val iosSimulatorArm64Test by getting {
dependsOn(iosTest)
}
}
}
android {..}
But I always get the following build error whenever I try accessing Strings.xx
inside my Swift file
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_StringsStrings", referenced from:
objc-class-ref in ContentView.o
ld: symbol(s) not found for architecture arm64
Any sort of hint will be of great help blob smilexxfast
09/07/2022, 3:47 AMiosArm64()
targetxxfast
09/07/2022, 3:49 AMkotlin {
..
listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64(),
).forEach { target ->
with(target) {
binaries {
framework {
baseName = "strings"
isStatic = false
}
}
}
}
..
sourceSets {
..
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)
dependencies {
implementation(Ktor.clientIos)
implementation(Square.sqlDelightNativeDriver)
}
}
..
}
}
lilypuchi
09/07/2022, 3:51 AMios
contains iosArm64()
already. 🤔
fun ios(
namePrefix: String = "ios",
configure: KotlinNativeTarget.() -> Unit = {}
) {
val targets = listOf(
iosArm64("${namePrefix}Arm64"),
iosX64("${namePrefix}X64")
)
createIntermediateSourceSets(namePrefix, targets.defaultSourceSets(), mostCommonSourceSets())
targets.forEach { it.configure() }
}
xxfast
09/07/2022, 3:53 AMiosArm64
and iosX64
, must be something else causing the issuexxfast
09/07/2022, 3:54 AMlilypuchi
09/07/2022, 4:00 AMxxfast
09/07/2022, 4:13 AMlilypuchi
09/07/2022, 4:24 AMxxfast
09/07/2022, 5:48 AMxxfast
09/07/2022, 5:49 AMSebastian Muggelberg
09/07/2022, 5:50 AMSebastian Muggelberg
09/07/2022, 6:25 AMios-x86_64-simulator
will not work on M1 Macs. You need ios-arm64_x86_64-simulator
to make it work in the simulator.lilypuchi
09/07/2022, 6:32 AMSebastian Muggelberg
09/07/2022, 6:35 AMlilypuchi
09/07/2022, 6:49 AM