

It helped me to solve this issue) Connect the KMM module to the iOS project If the Run/Debug configuration for an iOS app can not find a *.xcodeproj file, check this out.

The KMM plugin uses this path to locale the dependent project and grand the ability to build and run the iOS application from Android Studio. It works fine because I placed both projects in a common folder. So, the path above says: go back by one folder and open TheMovies_iOS. We can put a path that uses the Android project directory path as a start point. gitignore and increased minSdkVersion.Īlso, I added a relative path to the iOS project in gradle.properties xcodeproj=./TheMovies_iOS In the scope of this commit, I added kmmmodule/build folder to. You can find all changes related to the KMM module creation in this commit. So we need to add kmmmodule as a dependency to app module // adle in the app module dependencies We created a multiplatform module, but we don’t have access to it from the app.

Once you press the Finish button the KMM plugin will create a separate KMM module with default code templates. I chose kmmmodule as module name and as a package name. This task will create the Xcode framework with common code. I highly recommend selecting the Generate packForXcode Gradle task. Here you can choose name and package names for your KMM module. The current Android Studio version is Arctic Fox | 2020.3.1 Canary 1 It might differ depending on the Android Studio version. In our case, we will move common business logic to the KMM module and reuse it from Android and iOS applications. You can find a huge number of well-known companies that are using this technique right now and sharing their experience. In any case, sharing codebase brings some difficulty especially for iOS developers, because they will depend on a generated framework with common code.īefore you make your own decision I recommend going through these case studies. We can share the logic of network communications, caching information, and even the UI layer. Currently, the KMM community has a lot of libraries that allow us to share even more than that. The most common choice is to share business logic aka domain layer. You can find detailed interactions in the official documentation here. Make sure that you correctly configured the working machine for KMM. So, we will reuse existing projects, create a shared KMM module, place common code there, and configure projects to work with it.

The previous story explores SwiftUI and Jetpack Compose to build simple Android and iOS applications that display a list of mocked movies. Let’s take this opportunity and share common code between Android and iOS platforms. The first alpha version was released at the end of summer 2020, and I believe that we will see much more soon. Kotlin Multiplatform Mobile(KMM) is an SDK that allows you to use a language that you love so much and share the Kotlin code across multiple targets.
