I’m using this task in my shared module to generate the ios framework :
val packForXcode by tasks.creating(Sync::class) {
val targetDir = File(buildDir, "xcode-frameworks")
/// selecting the right configuration for the iOS
/// framework depending on the environment
/// variables set by Xcode build
val mode = System.getenv("CONFIGURATION") ?: "DEBUG"
val framework = kotlin.targets
.getByName<KotlinNativeTarget>("ios")
.binaries.getFramework(mode)
inputs.property("mode", mode)
dependsOn(framework.linkTask)
from({ framework.outputDirectory })
into(targetDir)
/// generate a helpful ./gradlew wrapper with embedded Java path
doLast {
val gradlew = File(targetDir, "gradlew")
gradlew.writeText(
"#!/bin/bash\n"
+ "export 'JAVA_HOME=${System.getProperty("java.home")}'\n"
+ "cd '${rootProject.rootDir}'\n"
+ "./gradlew \$@\n"
)
gradlew.setExecutable(true)
}
}
Which seems to work, I can find it under
build > bin > ios > debugFramework > SharedCode.framework
I then go over to xcode
Target > Frameworks, Libraries, and Embedded Content > + > Add files (inside the drop box)
then I navigate to
SharedCode.framework
and select it.
Xcode does not complain but when I try to build my project I get
Framework not found SharedCode
How am I suppose to add it ?