

After setting up the database and binding the platform drivers ( like here) we can create a class for our database - ShoppingListDb - which will consist any interaction with the database, as following: class ShoppingListDb(databaseDriverFactory: DatabaseDriverFactory) Īs you can see, the transactions are again pretty straight forward. We will start with our data layer - the ShoppingListRepository! This will connect our platforms to our database and allows us to read the items with Kotlin Flow, and insert/update/delete items. Note that you are now able to run the iOS application in Xcode as well! The result of the wizard is a single screen app with Hello World for both platforms. Initially I tried to use CocoaPods as the dependency manager for iOS, however I had build issues on the initial Hello World project, which led me to try the Regular framework - where the KMM module is integrated via internal Gradle task and Xcode - which worked like a charm. I created the project with the wizard provided in Android Studio (New Project/Kotlin Multiplatform App). 🙃 Setting up Kotlin Multiplatform Mobile KMM is planned to turn into beta in Spring 2022.Ĭaution #1: I have 0 experience with SwiftUI and also I am not that much skilled in Jetpack Compose, so the UI parts below may not be the best case, however building similar UI components with both frameworks will of course help us compare these 2 platforms. In the common Kotlin module used in both platforms we will provide a repository, where we will handle all data-related logic with a SQLite database - so we just need the implementation of the UI on the platform itself.Ĭaution #1: Mind that several features used in this post are still experimental. With this project, I aim to build a very simple shopping list for iOS and Android with KMM, where the UI is built in SwiftUI/Jetpack Compose of course 😌.
