vurlink.blogg.se

Kotlin multiplatform ios
Kotlin multiplatform ios






kotlin multiplatform ios

  • Kotlin shared code: this is the module containing the KMM project, here we will implement our business and presentation logic.
  • kotlin multiplatform ios

    Most of the code should be only SwiftUI and ComposeUI code.

  • iOS and Android: these modules contains the iOS and Android apps (Xcode and Android Studio projects).
  • Using the actual/expect protocol we can write platform specific code if needed, for example we will use this feature to be able to inherit our custom ViewModel class from Jetpack’s ViewModel.
  • Unlike other cross platform solutions, we don’t lose performance and we are able to use all the native libraries made for Android and iOS.
  • Write your app’s logic just one time, less code means less potential bugs.
  • Kotlin shared code is compiled to JVM bytecode on Android and to native binaries on iOS, so on Android we just add a Gradle dependency and on iOS we just link a framework. For example, to implement a native UI or when working with platform-specific APIs. You can share common code between iOS and Android apps and write platform-specific code only where it’s necessary. Kotlin Multiplatform Mobile (KMM) is an SDK designed to simplify the development of cross-platform mobile applications. If you are reading this article, I will assume you already have a notion of what KMM is, in which case you can move on to the next section.
  • Observe state changes from Compose UI / Swift UI and react to them.
  • Share business and presentation logic following a unique architecture on both platforms.
  • kotlin multiplatform ios

    If you want to go directly to the code, here is the demo code of my proposal which has been added to the official list of KMM samples What do we want to achieve? Kotlin shared code will contain the core logic while from the client side (iOS and Android) we will have very few code, just Compose UI and SwiftUI. We will review a framework for building KMM apps with the objective of not only share business logic but also presentation logic.








    Kotlin multiplatform ios