Join Slack
Has anyone already written a multiplatform, flow-based sharedpreferences/userdefaults?
# multiplatform
l
leandro
07/24/2019, 8:44 AM
Has anyone already written a multiplatform, flow-based sharedpreferences/userdefaults?
g
gildor
07/24/2019, 9:03 AM
not flow based, but there are a couple of implementations for example by
@russhwolf
https://github.com/russhwolf/multiplatform-settings
gildor
07/24/2019, 9:04 AM
Flow may be used as replacement for listeners, make sense to contribute imo
l
leandro
07/24/2019, 9:12 AM
That’s great, thank you Andrey
l
louiscad
07/26/2019, 8:15 AM
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
leandro
07/26/2019, 9:41 AM
Thanks Louis, will check it over the weekend
3
Views
Open in Slack
Previous
Next
kotlinlang
A modern programming language that makes developers happier.
Powered by