Git Product home page Git Product logo

Comments (4)

Alex009 avatar Alex009 commented on July 30, 2024

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.

ychescale9 avatar ychescale9 commented on July 30, 2024

Thanks!

from moko-kswift.

prvaghasiya avatar prvaghasiya commented on July 30, 2024

@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.

prvaghasiya avatar prvaghasiya commented on July 30, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.