Hello everyone, we are considering to start new pr...
# multiplatform
h
Hello everyone, we are considering to start new project with the KMM + compose multi-platform, are there any recommendations for entire stack like navigation, view-model, etc...?
h
πŸ‘ 2
j
I personally like Voyager, which has navigation, a screen model, state restoration et cetera. You'll find it on that list πŸ˜‰
πŸ‘ 1
j
No official recommendation, but my personal recommendation: β€’ DI, use Koin or Kotlin Inject β€’ Logging, Kermit β€’ Navigation: Circuit β€’ Arch: Circuit and/or Voyager β€’ Serialization: kotlinx serialization β€’ Async jobs, kotlinx coroutines β€’ DateTime: kotlinx datetime β€’ UI: Compose multiplatform β€’ Network/IO work: Ktor (Check kotlinx io once it gets KMP supported) β€’ GraphQL: Apollo β€’ Database, depends but I think sqdelight and androidx datastore is really good combo. Yes androidx working KMP. β€’ Pagination: androidx pagination β€’ Dynamic image loading: Coil, see release 3.0+ (Alpha 3 now I think) or Kamel There is ofc a lot of others out there, my subjective opinion after I evaluated most things out there πŸ™‚ Also it shifts over time, as more companies and SDK owners more and more going for Kotlin multiplatform. For me so far, it covers all my needs. Then if using Firebase, there is a KMP option for that. And you can combined interop with existing native libraries per platform ofc, with expect/actual when libraries not fulfil your need. As of example I am using androidx exoplayer on Android but AvPlayer on iOS native and combine with Compose multiplatform πŸ™‚
πŸš€ 4
h
Are there any major blockers for production?
j
@Hakob Astvacatryan I think you need to define what a blocker is to answer that question πŸ˜› That being like what features do your project need, how stable does it have to be etc. From what I heard of, but keep in mind that Wasm and iOS is both alpha. iOS soon getting into beta state btw. It is that textfields has been a painpoint for some iOS target users. What I tried so far in my app it works very well with libraries I mentioned. It has been some tweaks to get Firebase running in Xcode, but not so much KMP things, more annoying XCode things imo. If your targets is only Android and Desktop as of example, would be stable as both considered stable state πŸ™‚
When going all in CMP + KMP with 100% code sharing, my impression is that its get better, compared to if mixing a lot of native vs multiplatform exotic things. The less complexity you have in mixing, the easier it gets and reduce potential blockers. Also means that your mostly using Jetbrains thing as they are intended to, and not mixing with a lot of other things.
c
I come from the android world. So my team has like precompose because it's essentially everything that we're used to on Android but it'll work multi-platform
h
That is really nice that iOS will be moved to beta. We plan to target iOS and android. Let me give you some use case that we will have. 1. Text editing will be in few places only login/register 2. We will have maps. 3. Simple chat, maybe we can use some third party here 4. QR scanner 5. Geo location 6. ?Bluetooth low energy 7. Different payment methods For most of this things, I already found libraries like multi platform permissions, or BLE. I don't like navigation library solutions that exists actually, I would prefer something similar to the jetpack navigation. Ktor is pretty good, sqldeligh as well. So there is only navigation that bothers me and little bit and the map, but with the interoperability that KMM offers I kind of sure that we can figure it out.
πŸš€ 1
j
@Hakob Astvacatryan Really recommend test using Circuit navigation (Only navigation and nothing else), it feels very similar to androidx navigation but imo much much better. It does everything you wish Google already did to be honest. It even does things like dialogs, snackbars and bottomsheets insane easy to implement, no more Scaffolds for that needed. And it works across all platform targets. Jetbrains working btw on a cross platform solution for navigation, I hope it will become hybride of androidx and slack circuit variant of navigation, and working very nice for deeplinks and such. Curious, which BLE library using? πŸ™‚
h
Thanks man for the recommendation, I will take look, for the BLE I found kable, I haven't started yet but just trying to figure out stack.
j
Right, yeah I tried Kable but doesnt work well in Android to be honest, they do a lot of wrongs there. For android recommend try out androidx bluetooth instead, doing it the right way πŸ™‚ You can always bridge over with interfaces, but annoying I know. Hopefully Google will going for KMP style in androidx bluetooth, as they do with other libs.
h
That's a good information, so I guess having platform specific implementation for our use case will be better. We have also some OAuth sign-ins like google, apple and facebook. I found kmm firebase implementations, but not sure if it is worth to connect firebase for only that reason. Is there any other libraries that can cover it ?
j
Ktor supports OAuth I think, at least would be easy to setup. But can use Firebase devlive auth for sure. Recommend using androidx credential manager if you want passkeys to work. It works with GOogle sign in well. Easy to bridge over to KMM Firebase when having the token. Would be quite small fingerprint doing it πŸ™‚
Depending how connecting accounts, could be worth doing custom KTor Oauth implementation imo. But depends on your case ofc.
https://github.com/ktorio/ktor-documentation/tree/2.3.8/codeSnippets/snippets/auth-oauth-google Can go for this directly, not that complex things that other libs doing πŸ™‚ But yeah feels overkill to enable Google play services plugins only to fetch google play service config files in all platforms, and enable Firebase config, and then using like oneliner fetch OAuth and link accounts πŸ˜›
πŸ‘ 1
h
will take a look, thanks!
j
Can also recommend sometimes using Ktor to get some smart IO file operations like streaming to be cross platform. They have some nice things can re-use, until we have kotlinx io doing this in a nice way multiplatform. Very useful πŸ™‚
h
doesn't okio useful for that?
πŸ‘ 1
j
Dont remember feature subsets of io vs okio to be honest, I think Okio will be using kotlinx io later on as dependency.