Sebas

328 posts

Sebas banner
Sebas

Sebas

@sebaslogen

Full time life student and developer @q42 - I ❤️ to learn, share and improve myself and the things I build Go 👉 https://t.co/9exF8Lxeer

Amsterdam, Holanda Katılım Mayıs 2011
316 Takip Edilen243 Takipçiler
Sabitlenmiş Tweet
Sebas
Sebas@sebaslogen·
Resaca V4 moves to Compose Multiplatform! 🎉 This library lets you to scope ViewModels to a Composable, surviving configuration changes and navigation, now available in Android and iOS + you can use a separate ViewModel for each item in a Lazy list 🤯 github.com/sebaslogen/res…
English
2
4
32
1.6K
Sebas
Sebas@sebaslogen·
Call for Speakers for @kotlinconf 2026 is open only for a few more hours and I've just submitted a session about using Native Swift gRPC with the new SPM support in KMP! 🤞🤞 sessionize.com/kotlinconf-202…
English
0
0
0
47
Sebas
Sebas@sebaslogen·
@kihaki @joe_ptrkv_ch @JorgeCastilloPr No isFinishing helps detect beginning of Activity recreation, tricky part is to detect when new Activity finished creation, resume & composition with same/different Composables than when it started recreation There are 50+ tests for edge cases in resaca: #L115" target="_blank" rel="nofollow noopener">github.com/sebaslogen/res…
English
1
0
0
33
Sebas
Sebas@sebaslogen·
@kihaki @joe_ptrkv_ch @JorgeCastilloPr Unfortunately, detecting when an Activity is restarted and the Composable is not part of the Composition is quite tricky Hardcoding a delay will sometimes fail, waiting for the first frame solves this (not trivial) Feel free to check the docs for more info #rememberscoped-lifecycle-internal-implementation-details" target="_blank" rel="nofollow noopener">github.com/sebaslogen/res…
English
1
0
0
27
Bjørn Svenssen
Bjørn Svenssen@kihaki·
@sebaslogen @joe_ptrkv_ch @JorgeCastilloPr Wasn’t too hard to figure out tbh. It’s a bit of a pitty with the activity dependency for multiplatform but not too hard to solve either:
Bjørn Svenssen@kihaki

@joe_ptrkv_ch @JorgeCastilloPr Ich actually forgot an important detail: check compose scoped viewmodel disposal via a combination of disposableffect and activity.isfinishing - as I said just DM me if you want some code, we have it done and working here

English
1
0
0
49
Sebas
Sebas@sebaslogen·
@raamcosta @JetpkComposeApp Safe approach 👍 If you're interested in understanding the details, this documentation section of the Readme is the best place to start before digging at the API docs #rememberscoped-lifecycle-internal-implementation-details" target="_blank" rel="nofollow noopener">github.com/sebaslogen/res…
English
0
0
4
27
Rafael Costa
Rafael Costa@raamcosta·
@sebaslogen @JetpkComposeApp If I don’t understand it I don’t know whether it will be retained or not, feels weird. I don’t like using things I don’t understand ahah 😅
English
2
0
2
30
Sebas retweetledi
JetpackCompose.app
JetpackCompose.app@JetpkComposeApp·
ViewModel scoping in Compose has been broken from day one. You can only scope to Activity or navigation graphs, but Compose wants fine-grained components. Enter Resaca - the library that fixes this beautiful mess 🧵
JetpackCompose.app tweet media
English
8
4
62
9.4K
Sebas
Sebas@sebaslogen·
@kihaki @joe_ptrkv_ch @JorgeCastilloPr That's a good starting point and how this library started. Unfortunately the third point is way more complicated than it looks like and it only works on happy flows😰It took years to figure out all the edge cases with Android lifecycle. The other platforms are dead simple.
English
1
0
1
34
Bjørn Svenssen
Bjørn Svenssen@kihaki·
Very simple version would be this: - activity scoped viewmodel holding a viewmodelstore for your composable scoped VMs (you can also keep it as non config instance but an activity scoped VM is a bit more flexible) - custom version of remember that puts your composable scoped vms into that store with the composable position hash as key - make sure to do something like disposableEffect for clearing this composable scoped VM when it makes sense in your architecture (might just be a few seconds after the composable left the comp.) Roughly like that, didn’t take us longer than a day to get a prototype running, worked really well. If you DM me I can send you the working code, so it’s easier.
English
2
0
2
99
Sebas
Sebas@sebaslogen·
@raamcosta @JetpkComposeApp It's complicated so it doesn't fit in a tweet but the gist is:if the screen is not "really destroyed" but the Composable is disposed of, then resaca keeps it safe until the screen is active again to reuse it, only if requested again from the same spot.
English
1
0
1
38
Rafael Costa
Rafael Costa@raamcosta·
@sebaslogen @JetpkComposeApp How does it distinguish between leaving composition for good and leaving briefly or due to being in the back stack? Is it just a timing thing?
English
1
0
2
35
Sebas retweetledi
Find me on 🦋 : @p-y.wtf
Stop using this app. Musk is messing with your feed. Try the butterfly app!
Find me on 🦋 : @p-y.wtf tweet media
English
3
4
11
4.2K
Sebas
Sebas@sebaslogen·
Very excited and proud to see my last @droidconBerlin talk online🎉 Dependency injection: Koin vs Kotlin-inject 💉 in #KMP TBH, it's way better than the cocktail of nerves I remember😅plus I had a lot of fun😃 Check it out! droidcon.com/2024/08/30/koi…
English
0
4
16
588
Sebas
Sebas@sebaslogen·
@Weekly_Android It depends, it always depends😅 The size of an almost empty ViewModel is <0.2kB so it's ok for a bunch of VMs but I'll be mindful of too many. That you can use 1M VMs for a screen doesn't mean that you should. IMHO, good architecture has more impact than optimizing before needed
English
0
0
1
53
Sebas
Sebas@sebaslogen·
Resaca V4 moves to Compose Multiplatform! 🎉 This library lets you to scope ViewModels to a Composable, surviving configuration changes and navigation, now available in Android and iOS + you can use a separate ViewModel for each item in a Lazy list 🤯 github.com/sebaslogen/res…
English
2
4
32
1.6K
Sebas
Sebas@sebaslogen·
@belin_wu The gist: use rememberKeysInScope + list of keys for the VMs you wanna keep. Put it outside of both lazy lists & you get a KeyInScopeResolver. Then in lazy lists use viewModelScoped with the keyInScopeResolver and the key of that VM 🪄 to get VMs Docs: #scoping-in-a-lazycolumn-lazyrow-etc" target="_blank" rel="nofollow noopener">github.com/sebaslogen/res…
English
0
0
3
30
吴上阿吉
吴上阿吉@belin_wu·
@sebaslogen Great library, I got question for you, how to use a separate ViewModel for each item of a lazy list nested in another lazy list?
English
1
0
0
40