Introducing Kotlin Multiplatform in an existing mobile app - Workshop Edition
Abstract:
After discovering a new interesting technology or framework, you will probably start asking yourself how to integrate it into an existing project. That's because, the possibility of starting with a blank canvas is rare (not impossible, but rare).This is also the case for Kotlin Multiplatform, which is getting more and more hype every day. And now, that the technology has become stable, it's the perfect time to start using it! In this hands-on session, we will start with an existing Android and iOS application that "lives" in separate repositories, we will extract the business logic from the Android app and share it between the two apps with a Kotlin Multiplatform library. We will also cover how to distribute the library to the existing applications. By the end of this workshop, you'll have a better understanding of what is needed to start using Kotlin Multiplatform in your existing projects.
Slides:
To follow along in the workshop you will need:
- Android Studio with the Kotlin Multiplatform Mobile plugin:
- Xcode
Workshop material
The GitHub project contains a start folder with an initial workspace for the workshop:
and an end folder with two final workspaces: one that deploy the Kotlin Multiplatform locally and one that deploy it on GitHub packages.
Resources:
Creating a multiplatform binary framework bundle
https://developer.apple.com/documentation/xcode/creating-a-multi-platform-binary-framework-bundleBinary Frameworks in Swift
https://developer.apple.com/videos/play/wwdc2019/416/Binary Frameworks in Swift
https://devstreaming-cdn.apple.com/videos/wwdc/2019/416h8485aty341c2/416/416_binary_frameworks_in_swift.pdfBuild final native binaries
https://kotlinlang.org/docs/multiplatform-build-native-binaries.html#build-xcframeworksDistributing binary frameworks as Swift packages
https://developer.apple.com/documentation/xcode/distributing-binary-frameworks-as-swift-packagesKMP-NativeCoroutines
https://github.com/rickclephas/KMP-NativeCoroutinesmultiplatform-swiftpackage
https://github.com/luca992/multiplatform-swiftpackageXcode 13.3 supports SPM binary dependency in private GitHub release
https://medium.com/geekculture/xcode-13-3-supports-spm-binary-dependency-in-private-github-release-8d60a47d5e45