Are people using any particular approach for trigg...
# multiplatform
j
Are people using any particular approach for triggering the execution of shared code when application starts up (other than explicitly invoking from say Android and iOS app layer code at the appropriate time)?
b
Ktor has some funky mpp "service loader" implementation internally that executes arbitrary code at startup
j
Yeah, I think at least one option is something like this where
init
block is used....and probably fine in many cases....feels though that something more structured is needed in more complex cases but maybe reality in that case is that it has be something that's explicitly triggered from app layer.
b
I'm still dreaming for official mpp "service loader" api. Clearly it's possible, just needs to be standardised
p
@John O'Reilly I am curious about the use case.
j
One example might be some data you want to retrieve when app starts up
r
Not sure about iOS but for Android you could use a ContentProvider in the shared module.
m
@Rick Clephas, @John O'Reilly on Android you can register a startup initializer in the Manifest and execute lbrary code on startup without relying on app code to call you.
🙌🏻 1
🙌 1
j
Seems like there's a few approaches all right that can be used for Android....anybody come across anything similar for iOS (and potentially other platforms)?
Maybe reality is that something in app layer is going to be needed to trigger this.....
r
Yeah in the end the app needs to trigger something one way or another. ContentProviders in Android can automate this but I am not aware of such an feature in iOS…