Hey all - sorry for the delayed response. I was on...
# orbit-mvi
m
Hey all - sorry for the delayed response. I was on holiday. Since there have been a few questions regarding Orbit's iOS/KMP support here's the current context: 1. We have very limited time to work on Orbit due to work/family/health obligations so we are focusing on core functionality and KMP support. We are very careful about what features/projects we take on. 2. Please assume no further work will be done on the Orbit Swift plugin. We consider improved Swift support to be out of scope due to the amount of work required and the fact KMP support has now vastly improved and there are already some much better alternatives, such as the excellent SKIE project. 3. We will consider working on better KMP support where Orbit is still rough around the edges even after applying other patterns like KMP ViewModels, SKIE. Please file tickets with specific improvement ideas, since we have limited opportunities to explore KMP on our own. 4. We are aiming to provide some guidance around KMP extension projects to consider when using Orbit in iOS. In the meantime, here is a number of projects to consider: a. SKIE b. https://moko.icerock.dev c. https://github.com/rickclephas/KMP-NativeCoroutines d. https://github.com/rickclephas/KMM-ViewModel e. Thanks to @Guilherme Delgado for the last two. Note that we've done limited research ourselves, so please use your own judgement here. Hopefully this anwers your questions @Jacob Rhoda
❤️ 5
👍 1
g
Thanks for your clarification 🙌
m
I would appreciate your thoughts and comments on this 🙂
g
I’m creating a new POC to explore wasm (while sharing VM between Android, iOS, Desktop and Wasm) and after it I’ll share my thoughts and also publish this POC 😊
❤️ 1
Quick preview I can share 🙂
• Kotlin Multiplatform (KMP) with FSM and UDF shared between Android, iOS, Desktop, Web (via Wasm) with UI + FSM state restoration; • Compose Multiplatform (CMP) for
wasmJs
,
desktop
e
android
and
iOS
(also with a SwiftUI sample)
When ready I’ll make it public 😉
(used rickclephas’s KMP-NativeCoroutines and KMM-ViewModel libs)
j
Is the idea that you use the KMM-ViewModel lib to handle observing the
state
changes, rather than the state Flow? In that case, does it use KMP-NativeCoroutines (or potentially SKIE) to observe the
sideEffect
flow?
g
I use the
stateFlow
and the KMM-ViewModel library helps with the lifecycles. Then I use KMP-NativeCoroutines to extends it to iOS to asyncAwait, etc.
Copy code
private val _uiState = MutableStateFlow(viewModelScope, TimerUiState())

@NativeCoroutinesState
val uiState = _uiState.asStateFlow()
this is just the setup I need ^, pretty simple
(and extend my viewmodels from
KMMViewModel
)
j
So you’re not even using Orbit then?
g
I don't, because there's no KMP support 🫠
j
Oh, I thought the thought was to use KMM-ViewMode like the Android version of Orbit.
g
Orbit could use it for us
but then again, Google is making that move
let’s see also how it impacts KMM-ViewModel
j
It’s my understanding that to use Orbit with Android ViewModel, you implement ContainerHost and subclass from ViewModel. Couldn’t you substitute the Android ViewModel for KMMViewModel?
g
that’s a good questions for @Mikolaj Leszczynski, but I would say yes.
actually with orbit “KMP” I guess we must use
dev.icerock.moko.mvvm.viewmodel.ViewModel
ContainerHost
doesn’t care about VM, only the scope (
viewmodelScope
in this case)
j
Yes, that’s another option.
I ended up rolling my own, but it doesn’t handle lifecycle which I would like it to.
g
the question is, how well does Orbit works with
KMP-Coroutines
@Jacob Rhoda I have this public POC: https://github.com/GuilhE/Expressus
m
correct, the Orbit
Container
's only dependency is a
CoroutineScope
g
it uses Orbit in “KMP” but I made the logic by hand since the gradle plugin doesn’t work
I use Combie (Publishers) instead of async await (KMP-Coroutines gives you that option)
👍 1
m
thanks for your example @Guilherme Delgado, I'll take a look when we get to work on the KMP guidance
👍 1
g
in my new POC I’m testing KMP-VM and KMP-Coroutines
not yet ready but I’ll share it when it becomes 😊
m
give SKIE a try as well 😉
as far as their selling point goes, it builds swift-native wrappers for Kotlin
Flows
and coroutines
j
The problem with SKIE is that it’s harder to figure out how to adapt an async-await Flow to @ObservableObject since it doesn’t use Combine…
👍 1
m
yeah KMP-coroutines looks good on that front
g
yah, I haven’t tried SKIE (first because it was payed back then) and it looks like a bazuca for me
I’m more a lightweight guy 😅 that’s why I choose Orbit
❤️ 1