The build script gives you the ability to specify dependencies for each of your source sets. The structure contains a source set for platform specific logic for iOS (iOSMain) and Android (AndroidMain) and for common code (commonMain). It will create the following directory structure for a shared module. The Kotlin Multiplatform plugin creates the scaffolding for a project. ![]() How do we set up our project? Scaffolding In our project setup, we will have a shared module containing an API client and logic to cache data. It’s a very simple example of a Kotlin Multiplatform app. We’ll build an Android and iOS app that gets data from the network, caches it and displays it in the UI. Solving these problems once is beneficial across Android and iOS. There are similar libraries and approaches to tackling these problems on both platforms. We solve similar problems on both platforms such as getting data from the network, parsing it, handling analytics and implementing business logic. I started to explore Kotlin Multiplatform because it allows you to share code between Android and iOS. ![]() In this article, I’ll explore how to build a Kotlin Multiplatform app in 2021 and compare it with my previous experience. But, Kotlin Multiplatform has come along far since 2018. I had to use multiple IDEs (XCode, Android Studio, CLion). During that time, it was challenging to set up network requests, serialization and video playback. I had given a presentation from my learnings at the Kotlin NYC meetup. ![]() When I first started to learn Kotlin Multiplatform in 2018, I started by trying to build an app that displays a list of videos and plays them for both Android and iOS.
0 Comments
Leave a Reply. |