I can see KampKit uses MultiplatformSettings in an...
# touchlab-tools
I can see KampKit uses MultiplatformSettings in another different way. Settings are defined in AndroidMain and IosMain, but they are instantiated in the platform-specific app code via Koin.
The benefit of this approach, is the platform-code only needs to care that it should set up a Settings instance in Koin (and how), but the common code is the only bit that cares about hooking that into the required components (such as your DataRepostory).
OK, I see now. So is Koin the way to pass the Android Context and the SharedPreferences object to the shared code? I guess it is
I was actually looking for a way to pass the Android Context to the shared code, but I didn’t understand Koin was the way to do this.
You don’t need to us Koin. You can just pass implementations in on app start. Passing the Android Context into shared code is going to be problematic. You can do it, but what’s the iOS equivalent?
Maybe using different constructors, but yes, that would not be very clean. So I chatted with Russ and he told me about the
, which does not require the Android Context, which sounds awesome.
what do you mean by “passing implementations in on app start” ?