What's new in Kotlin for KMM
KMM is part of the larger Kotlin ecosystem and leverages Kotlin features and improvements for a better mobile developer experience. Every Kotlin release brings features and improvements that are helpful for mobile developers like you.
Android Studio will recommend an automatic update to a new Kotlin release. You can also update manually.
Here you can find a short summary of the features Kotlin provides for developing multiplatform mobile applications.
Kotlin 1.5.30 for KMM
Kotlin 1.5.30 introduces a number of improvements and features that are helpful for KMM:
Learn more about Apple silicon support.
Improved Kotlin DSL for CocoaPods Gradle plugin. Kotlin 1.5.30 introduces the improved CocoaPods Gradle plugin DSL. In addition to the name of the framework, you can now specify other parameters in the pod configuration:
Dynamic or static version of the framework
Dependencies explicit export
Custom names for Xcode configuration
Experimental interoperability with Swift 5.5 async/await. The Kotlin/Native compiler now emits the
_Nullable_resultattribute in the generated Objective-C headers for suspending functions with nullable return types. This makes it possible to call them from Swift as
asyncfunctions with the proper nullability.
Improved Swift/Objective-C mapping for objects and companion objects. Getting objects and companion objects can now be done in a way that is more intuitive for native iOS developers.
cinteroplibraries between platforms. Starting from Kotlin 1.5.30, you can use custom cinterop libraries in shared native code.
Support for XCFrameworks. Now all Kotlin Multiplatform projects can use XCFrameworks.
New default publishing setup for Android artifacts. Kotlin 1.5.30 brings new default publishing setup for Android artefacts. You can publish your multiplatform library for the Android target by specifying Android variant names in the build script. The Kotlin Gradle plugin will generate publications automatically.
Kotlin 1.5.20 for KMM
Kotlin 1.5.20 introduces a number of improvements and features that are helpful for KMM:
Export of KDoc comments to generated Objective-C headers. You can now set the Kotlin/Native compiler to export the documentation comments (KDoc) from Kotlin code to the Objective-C frameworks generated from it, making them visible to the frameworks’ consumers.
This feature is experimental. We would appreciate your feedback on it in YouTrack.
New framework-packing task for Kotlin/Native. The Kotlin Multiplatform Gradle plugin now includes the
embedAndSignAppleFrameworkForXcodetask, which can be used from Xcode to connect KMM modules to the iOS part of your project.
Check out this blog post to learn about the new framework-packing task and how to remove from the
packForXcodetask from your build script.
Learn more about what's new in Kotlin 1.5.20.
Kotlin 1.5.0 for KMM
Kotlin 1.5.0 introduces a number of improvements and features that are helpful for KMM:
Simplified test dependency selection for each platform. Now you can use the
kotlin-testdependency to add dependencies for testing in the
commonTestsource set. The Gradle plugin will infer the corresponding platform dependencies for each test source set:
kotlin-test-junitfor JVM source sets.
kotlin-test-annotations-commonfor common source sets.
iOS source sets use Kotlin/Native, which has everything built in, so they do not require any additional artifacts.
You can also use the
kotlin-testdependency in any shared or platform-specific source set. Learn more about setting dependencies on test libraries.
New API for getting a char’s Unicode category. A variety of new character-related functions are available on all platforms and in the common code. They include several functions for checking whether a char is a letter or a digit, like
Char.isLetterOrDigit(), as well as functions for checking the case of a char, like
Char.isUpperCase(). The property
Char.categoryand the enum class
CharCategoryare available, as well.
Learn more about this new API.
Improved Kotlin/Native performance and stability. Kotlin/Native is receiving a set of performance improvements that speed up both compilation and execution.
Learn more about the Kotlin/Native improvements.
Learn more about what's new in Kotlin 1.5.0.
Kotlin 1.4.30 for KMM
Kotlin 1.4.30 introduces a number of improvements that are helpful for KMM:
Improved compilation time for an iOS simulator. Recompiling binaries for the iOS simulator after making changes in the code now requires much less time. You can see the most significant improvements when re-running unit tests or applications on the iOS simulator. For example, the time required to rebuild the framework in the KMM Networking and data storage sample has decreased from 9.5 seconds (in 1.4.10) to 4.5 seconds (in 1.4.30).
These optimizations affect other scenarios as well.
Support for libraries delivered in Xcode 12.2.
Support for the new watchosX64 target in Kotlin/Native. This target makes it possible to run the simulator on 64-bit architecture.
Learn more about what's new in Kotlin 1.4.30.
Kotlin 1.4.20 for KMM
Kotlin 1.4.20 introduces a number of features, improvements, and bug fixes that are helpful for KMM:
CocoaPods plugin improvements:
Support for libraries delivered in Xcode 12.
Escape analysis for Kotlin/Native. A prototype of a new mechanism that gives a 10% iOS runtime performance improvement by allocating certain objects on the stack instead of the heap.
Opt-in wrapping of Objective-C exceptions in runtime to avoid crashes. Learn how to opt in.
Updated structure of multiplatform library publications. The library root publication, which stands for the whole library, now includes metadata artifacts. These were published separately in earlier Kotlin versions.
For compatibility, both multiplatform library authors and users must update to Kotlin 1.4.20. Learn more about publishing a multiplatform library.
Deprecation of the Kotlin Android Extensions plugin. The
Parcelableimplementation generator has been moved to a separate
Learn more about what's new in Kotlin 1.4.20.