After including assist for desktop apps and the Net, JetBrains multiplatform declarative UI toolkit now runs on iOS in alpha.
Primarily based on Google Jetpack Compose, just lately up to date with improved efficiency and extensions, Compose Multiplatform runs natively on Android and, due to Kotlin Multiplatform on Home windows, Linux, macOS, and the Net, too. The addition of iOS extends Compose Multiplatform to all main OSes.
The method adopted by Compose Multiplatform is to supply the identical API throughout all supported platforms, replicating Jetpack Compose APIs:
The APIs in Compose Multiplatform are the identical ones which have already been tried and examined in Jetpack Compose. Meaning builders who’ve expertise writing trendy Android person interfaces utilizing Jetpack Compose can switch these expertise straight to write down a shared person interface with Compose Multiplatform, concentrating on iOS and past.
This consists of state administration, structure composition, and animations. For numerous options which might be strictly OS-dependent, like loading assets, Compose Multiplatform supplies its personal higher-level abstractions to maximise portability.
On iOS, Compose Multiplatform makes use of canvas-based rendering, utilizing the Skiko graphics library. Also referred to as Skia for Kotlin, Skiko relies on Skia, Google’s graphics library used for Chrome, ChromeOS, and Flutter.
This method implies that Compose Multiplatform apps have the identical feel and look throughout all supported platforms, equally to Flutter apps. Not like Flutter, although, Compose Multiplatform supplies Materials and Materials 3 widgets out of the field, so Compose Multiplatform apps will simply seem like plain-vanilla Android apps. Whereas Materials is the one widget look-and-feel at the moment supported on iOS, JetBrains has not but made a last choice about whether or not to supply a local widget look-and-feel.
An vital side of making cross-platform apps is interoperability with the underlying OS SDK. Compose Multiplatform for iOS supplies a two-way interop layer on prime of UIKit
, with two fundamental courses, UIKitView
and ComposeUIViewController
. UIKitView
allows embedding platform-specific widgets like maps, net views, media gamers, and digital camera feeds inside a Compose UI. ComposeUIViewController
can be utilized as a substitute to embed Compose screens in UIKit and SwiftUI functions. This may be useful to step by step convert an present app right into a Compose app.
To start out working with Compose Multiplatform for iOS, you will want a machine operating current model of macOS, Xcode, Android Studio, and the Kotlin Multiplatform Cellular plugin. All further dependencies could be managed by CocoaPods.
The perfect place to begin is among the mission templates offered by JetBrains. These embody a fundamental iOS/Android app, an picture viewer, a chat app, and many extra. Plenty of tutorials are additionally out there to information you thru utilizing the commonest UI parts in a Compose Multiplatform app.