- Kotlin Multiplatform allows you to share your business logic on multiple platforms like android, iOS and native desktop applications and as a result reducing the amount of time required for development.
- Kotlin Multiplatform (KMP) and Kotlin Multiplatform Mobile (KMM) are not seperate technologies. You can think of Kotlin Multiplatform Mobile (KMM) as a subset of Kotlin Multiplatform (KMP) which primarily focuses on mobile features. Kotlin Multiplatform Mobile (KMM) uses the multiplatform capabilities of kotlin to share bussiness logic of iOS and Android apps.
- Using KMM we can write our business logic once and reuse that for both the platforms android and iOS. We only need to write our platform specific code wherever it's necessary for example to implement our native UI. Does that mean we can have a single application which can run on both Android and iOS app using KMM ? No KMM is specifically design to share only business logic and use native UI to have exact look and feel as simple Android or iOS app. So we still need to create seperate applications for both the platforms.
This is a sample KMM project which tries to shares as much as code possible between Android and iOS.
Android App | iOS App |
---|---|
- Android Studio – version 4.2 or higher.
- Xcode – version 11.3 or higher.
- This app displays a list of movies using API from TMDB so you must have a valid api key from TMDB. (If you don't have one you can get it here :- https://www.themoviedb.org/documentation/api)
- Open Android Studio
- Add KMM Plugin from
Android Studio
->Preferences
->Plugins
->MarketPlace
->Search for Kotlin Multiplatform Mobile
->Install and Restart Android Studio
- Run app.
- Pretty Simple KMM allows you to run and debug your iOS App from Android Studio itself. Just switch from
androidApp
toiosApp
in your run configurations menu. (Remember :- This app containsPods
so we need to install that from Terminal first before running iOS app from Android Studio or xCode) - If you are an Android Developer who wants to explore iOS App or a newbie in iOS development and got confused about how to work with pods, we got you covered! You can find everything about pods here : :- https://cocoapods.org/
- Does that mean you can simply run iOS App without xCode or macOS machine ? No You still need a macOS , xCode (and Simulators) and command line tools installed on your machine to run your iOS App.
- Also you can run this project with xCode.
- Open
iosApp
folder from the project installpods
with terminal open.xcworkspace
and run your application.
Support it by joining stargazers for this repository. ⭐
Whether you're helping us fix bugs, improve the docs, or a feature request, we'd love to have you! 💪
Check out our Contributing Guide for ideas on contributing.
For bugs, feature requests, and discussion please use GitHub Issues.
This project is licensed under the MIT License - see the LICENSE file for details