Comments (4)
hi! for regular framework at now i suggest next approach:
add copy action to Link tasks, so after each compilation of kotlin/native all generated sources will be moved to your directory.
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinNativeLink>().matching {
it.binary is org.jetbrains.kotlin.gradle.plugin.mpp.Framework
}.configureEach {
doLast {
val swiftDirectory = File(destinationDir, "${binary.baseName}Swift")
val xcodeSwiftDirectory = File(buildDir, "generated/swift")
swiftDirectory.copyRecursively(xcodeSwiftDirectory, overwrite = true)
}
}
and add this directory into xcode project by "add files".
see my sample - https://github.com/Alex009/moko-kswift-usage-sample/tree/regular-framework
and here commit with integration - Alex009/moko-kswift-usage-sample@fc92131
from moko-kswift.
Thanks!
from moko-kswift.
@ychescale9 Sample does not compile in Apple M1 mac
Also, when I use this workaround in latest KMM template from Android Studio. destinationDir is not defined, looks like it is removed. I am not able to generate these classes. Can you please help?
from moko-kswift.
Ok this works by replacing destinationDir
with outputFile.get()
Thanks to PR
Full snippet
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinNativeLink>().matching {
it.binary is org.jetbrains.kotlin.gradle.plugin.mpp.Framework
}.configureEach {
doLast {
val swiftDirectory = File("${outputFile.get()}/..", "${binary.baseName}Swift")
val xcodeSwiftDirectory = File(buildDir, "generated/swift")
swiftDirectory.copyRecursively(xcodeSwiftDirectory, overwrite = true)
}
}
However, Moko classes are not being generated in case of latest XCFramework syntax
kotlinArtifacts {
Native.XCFramework("BL") {
targets(iosArm64)
modes(DEBUG)
// dynamic framework
isStatic = false
// disable bitcode
embedBitcode = EmbedBitcodeMode.DISABLE
}
}
}
from moko-kswift.
Related Issues (20)
- It's seems, that current library don't work with gradle 7.5 and with other dependency HOT 1
- Code generation not working on new kotlinArtifacts DSL Module
- Files for external libraries generate with errors HOT 1
- Bad interop with swift Arrays HOT 2
- How can I implement SealedToSwiftEnumFeature for xcframework? HOT 3
- Is it necessary to name a multiplatform lib exactly 'MultiPlatform Library' HOT 2
- Unable to generate extensions Pair
- excludeLibrary/includeLibrary should use group+name value
- Compile Swift code inside Kotlin framework HOT 1
- Generated Swift.podspec should read deploy target version for xcode 14 HOT 1
- Add extension field to Kotlin sealed class for conversion to Swift enum
- Generate extension functions for classes which have public functions accepting sealed classes instances as parameters
- Invalid generation of enums when sealed class/interface declaration is nested in other class and it's subtypes are not inside sealed class
- Generate code for extension with lambdas
- Generic class inside sealed class not generated properly
- At which phase code is actually being generated? I need to run build 2 times HOT 2
- Build warnings caused by unneeded force cast
- Add support for single swift file generation in multimodule project to simplify manual linking of generated swift code to XCode project
- Add configuration of generated swift files path inside gradle plugin
- Swift code does not generating when calling kSwift{moduleName}Podspec task
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from moko-kswift.