Ecosystem iOS Multiplatform Native Releases

Kotlin/Native v0.8 released

We’re happy to announce the release of Kotlin/Native v0.8! The focus of this release is on:

  • safer concurrent programming
  • extending the stdlib functionality
  • better iOS development support.

Also, numerous bug-fixes and optimizations were implemented in this release.

AppCode and CLion Kotlin/Native plugins were updated to work with v0.8, along with minor performance and usability improvements.

Binaries can be downloaded from the following links: macOS, Linux, Windows

A Linux Snap package is also available.

GitHub release page is here.

Better concurrency support.

Before v0.8, Kotlin/Native applications were keeping the singleton object state local to a particular thread of execution, so the state of singleton objects on different threads could be non-synchronized. Now, extending the notion of freezing on singleton objects, we allow a shared immutable state.

For example, following code

will read the configuration file and can provide a Config.width property later on.  The Config file will be read once per process execution, and is available to any thread or worker. Once published, the object is frozen, and cannot be modified anymore (modification attempts will throw an InvalidMutabilityException).

Another feature intended for better concurrency support in Kotlin/Native is the atomic values and references. For example, to extend the above sample of a program-wide configuration by adding a potentially updateable program icon, we could do

Note, that operation is atomic, and icon data stored in an AtomicReference itself is frozen. This way we can ensure that the data updates are atomic, and all the other clients see a consistent state.

Library improvements.

With the release 0.8 standard library (kotlin.*) in Kotlin/Native is finally standardized with other platforms using expect/actual mechanism, and mostly (modulo reflection and some synchronization-related operations) matches other Kotlin flavors. Also, the standard random number generator and collection shuffling functions are now available, so there is no need to use platform-specific APIs to obtain random numbers anymore.

Other important JetBrains-provided libraries, like kotlinx.coroutines, kotlinx.serialization, and Ktor HTTP client are getting experimental Kotlin/Native support, which means it is possible to write an iOS app and Android application sharing the same REST API-related logic.

iOS support improvements.

We are working hard on making Kotlin/Native a viable iOS development technology, so in this release, we fixed few annoying problems preventing publishing to AppStore, a framework initialization problem and supported 32-bit ARM iOS, so that older devices can be used with Kotlin/Native as well.

Let’s Kotlin

image description