Maybe just changing the libraries imports? :sweat_...
# orbit-mvi
g
Maybe just changing the libraries imports? 😅 it would be awesome
m
Thanks for pinging us about this! I will need to make the module multiplatform - and there is some Espresso idling resource code I need to figure out what to do with. Other than that it should be a straight swap I think 🤞
awesome news!
PS I wonder how
LifecycleOwner
is implemented on the iOS side 😄
😇
a
I’m currently going through all my personal open source projects about to look at all this stuff while I have the motivation (and more importantly time)
g
did a first try and it seams the KMP libs are:
Copy code
androidx.lifecycle:lifecycle-runtime-compose
androidx.lifecycle:lifecycle-viewmodel
but Orbit also relies on:
Copy code
androidx.lifecycle:lifecycle-viewmodel-ktx
androidx.lifecycle:lifecycle-runtime-ktx
androidx.lifecycle:lifecycle-viewmodel-savedstate
which i believe were not ported.
Copy code
:orbit-compose:iosArm64Main: Could not resolve androidx.lifecycle:lifecycle-runtime-ktx:2.8.0-rc01.
Required by:
    project :orbit-compose

Possible solution:
 - Declare repository providing the artifact, see the documentation at <https://docs.gradle.org/current/userguide/declaring_repositories.html>
So maybe some refactor its going to be needed, but I might be wrong.
👍 1
a
lifecycle-runtime-ktx
should be changed to
lifecycle-runtime
as the
-ktx
variants have been merged in and no longer provided separately
doesn’t look like
savedstate
has been ported so that would have to be extracted out no doubt
1
😅 1
as a starting point to better prepare the project i’ve started updating all dependencies to the latest
👍 1
g
I was using Kotlin-2.0.0-RC1 because of the new compose compiler simplifications, building smooth except for some non-kmp dependencies like savedstate
also updated the build.gradle files to become multiplaform, was ok
only “hack” I had to do was disable the jacoco by commenting the file, it was failing and I have no experience with it to understand why
a
regarding savedstate myself and @Mikolaj Leszczynski had previously discussed pulling out into a separate module to help with multiplatform support anyway so perhaps this accelerates that plan. we were never quite sure how to support state saving for iOS anyway
👍 1
g
In my POCs I always endup implementing that by hand, is not that hard too, of course we don’t have the same nice features but we can live without them too.
for google not porting that, either is WIP or the same philosophy
although DataStore is KMP ready so they could implement it in theory (and leave it “blank” for iOS for instance)
I never saw iOS deal with background restore and config. changes like Android
but I’m not that experienced in that platform
a
the mechanism is just a little different and it doesn’t occur at quite the same frequency as on Android
g
I would say that a barebones “saved state” implementation would be creating a proxy for the state, collecting all its emission and store them in the DataStore.
a
theres a mechanism in swift too from what i remember; been a while since i’ve looked at it though
g
and then check cache uppong containerhost creation (VM init)
a
the problem i was struggling with using that approach was knowing the difference between something being created , i.e. new and not using saved data vs recreated and using saved data
m
I think we need an abstraction layer that does not rely on platform semantics
and then we'll figure out how to solve this per platform
Not done any research on this, so forgive me if I'm stating the obvious XD
a
yes which is what we’d previously discussed doing to pull it out from the main module 🙂
👍 1
(just been a while)
😄
m
haha yes
g
What I did was uppon “SavedStateContainer” creation check for cached state, but I feel the struggle, sometimes is just coming back again to the screen (in my POC I do want to preserve the state so i guess it’s a biased implementation). I believe this delegation depends on “app logic” so I guess the user would be responsible to activate the restore in the VM init? 😅
m
maybe it's a good idea to just give the restored state to the user and go
here, this is what I remembered, do what you will with it
g
yup i think is best too
that’s how savedstate works btw
we have to check if it has data to emit
But recently using orbit i don’t have to think much about it 😛 only in the past when using “live data” i was creating them by checking the savedState instance
👍 1
m
uh we'd have to migrate to
kotlinx.serialization
too
🙏 1
currently we rely on
Parcelable
😞
g
just a matter of time until androidx.savedstate becomes available 😎