Kotlin 1.5.30: Apple Silicon Support for KMM

Did you know that there is now native support for Apple Silicon Macbooks? Kotlin 1.5.30 comes with an update that lets you build your KMM project on Apple Silicon devices without requiring any additional actions.

Previously, to achieve this, you needed to perform your build on the Rosetta environment and add a couple of flags to your Xcode project to support the new chip and simulator architecture.

Guess what, all you have to do now is to add a line of code to your build.gradle file and you are good to go.

kotlin {

    // ...
    val xcf = XCFramework()

    iosSimulatorArm64 { // <--- Here
        binaries.framework {
            baseName = "shared" // Replace with library name as you wish
            xcf.add(this)
        }
    }
    
    // ...
}

The single line of code above adds the new target and instructs the compiler to generate arm64 simulator framework file as part of the xcframework at a go.


You can read up more about this support and other benefits Koltin 1.5.30 have to offer from the release notes.

Cheers!