Hi All, Has anyone explored creating custom iOS an...
# ios
d
Hi All, Has anyone explored creating custom iOS and android SDKs using KMM? I would like to know some good practices and challenges using KMM for SDK development.
m
Hello, yes. I'm developing an iOS/Android app using a custom and shared SDK to handle network requests and some storage (preferences, cache, database). It works fine!
d
Thanks, @Matheus Matos, I was looking for answers from the SDK development point of view and not the App itself. If anyone has shipped a production iOS and Android SDKs using KMM and not App. Any references to existing KMM SDKs in production will really help.
l
Do you target Kotlin or Swift consumers?
d
We aim to target both consumers who want to write native Apps. Our Consumers: Looking for native SDKs to build Apps. Us: We create these public-facing custom SDKs which support both iOS and Android for native SDK app developers I am aiming to use this option from the android studio to create Kotlin Multiplatform library.
Screenshot 2023-06-15 at 14.48.36.png
m
Yes, it is entirely possible to implement an SDK with KMM. You would need to provide specific platform implementations. In my case, I have a
SDK.initialize()
method that takes
Context
as a parameter in Android, but it doesn't exist in iOS. However, in general, you can reuse the majority of the code.
l
@Matheus Matos You can use Splitties App Context if you just need access to the application context on Android.
d
@louiscad What is Splitties App Context ? , I am a bit new to KMM as you can see from my questions 🙂
Splitties is a collection of small Kotlin multiplatform libraries (with Android as first target).
l
@Deepesh Vasthimal First result on Google for "Splitties App Context" : https://splitties.louiscad.com/modules/appctx/
d
Splitties mentions Android as the first target. What about iOS support then ?. Is there any example of KMM SDK which is adopted on both iOS and Android platforms?
l
Splitties App Context is only a small part of Splitties, and it's for what the documentation I linked says it is. You don't have that specific
Context
problem on iOS, so it's irrelevant.
Splitties itself has some modules that target iOS as well, but I don't think it's relevant to your specific use case.
d
@louiscad Coming back to this, Are these KMM libraries not supported for iOS? I am looking to create something similar that can work on iOS and Android, consumed by native iOS and Android App developers.
l
KMM≠KMP
d
@louiscad Are the above not KMM based libraries ?
l
Take some time to uncover the acronyms, and how they are related to each other, everything will make more sense to you once you'll get that