for Android and iOS with native look and feel but you don’t want to write the same code twice. 2. You have existing app for Android and iOS, you want to share code between 2 platforms at minimal cost. Problem 2
possible? Are you okay with having limited performance if it reduces time-to-market Are you ready to have two dev teams working on separate codebases for each platform Then, you need to choose from these options Are you building an ecommerce app? Are hardware functionalities like camera or GPS a must? Hybrid app Cross-platform app Progressive web app Native app Yes No No No No Yes Yes Yes No Yes
An Xcode project that builds into the iOS application. The code that works on both platforms, including the expect declarations. Android-specific parts, including actual implementations. iOS-specific parts, including actual implementations.
class Platform actual constructor() { actual val platform: String = "Android ${android.os.Build.VERSION.SDK_INT}" } import platform.UIKit.UIDevice actual class Platform actual constructor() { actual val platform: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion } shared/androidMain shared/iosMain shared/commonMain
MLKit Room Biometric Play Services Lots of community and libraries 16 View View Native code iOS specific APIs AVFoundation CoreML Local Authentication Accounts Cloudkit Lots of community and libraries
for Android and iOS with native look and feel but you don’t want to write the same code twice. 2. You have existing app for Android and iOS, you want to share code between 2 platforms at minimal cost. Problem 19
in Kotlin for Android Refactor it to be compatible with iOS Implement Native UI on Android/iOS Project New Project Existing Project Connect .framework to iOS project and .jar to Android Project Take a new feature
class Platform actual constructor() { actual val platform: String = "Android ${android.os.Build.VERSION.SDK_INT}" } import platform.UIKit.UIDevice actual class Platform actual constructor() { actual val platform: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion } shared/androidMain shared/iosMain shared/commonMain
• Your project isn't going to be released very soon. • You don't care about KMM being in alpha status right now. • Your app is complex, tied strongly to multi-thread or has background processing. When to use KMM 28
feel on every new OS version. • Single codebase for the business logic. • Get all the cross-platform benefits in your existing project. • Use iOS and Android features without any overhead. • Use Kotlin for cross-platform code. Conclusion 31