Has anyone already written a multiplatform, flow-b...
# multiplatform
l
Has anyone already written a multiplatform, flow-based sharedpreferences/userdefaults?
g
not flow based, but there are a couple of implementations for example by @russhwolf https://github.com/russhwolf/multiplatform-settings
Flow may be used as replacement for listeners, make sense to contribute imo
l
That’s great, thank you Andrey
l
I'm working on it and already using dev version of it: The module's root: https://github.com/LouisCAD/Splitties/tree/develop/modules/preferences The (not documented yet) Flow related code is here: https://github.com/LouisCAD/Splitties/blob/eb4cc37027b0f6a9ca34be24816016142ae8d869/modules/preferences/src/commonMain/kotlin/splitties/preferences/PrefDelegate.kt#L34-L60 What I did was to port Android's SharedPreferences interface on macOS and iOS, then translate the delegate API I was using on Android previously. I plan to support observing changes made on the underlying
NSUserDefaults
instead of only the instance of the wrapper for iOS and macOS, but I'm struggling a little with the KVO Obj-C APIs.
l
Thanks Louis, will check it over the weekend