Thread
#multiplatform
    John O'Reilly

    John O'Reilly

    11 months ago
    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)?
    Big Chungus

    Big Chungus

    11 months ago
    Ktor has some funky mpp "service loader" implementation internally that executes arbitrary code at startup
    John O'Reilly

    John O'Reilly

    11 months ago
    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.
    Big Chungus

    Big Chungus

    11 months ago
    I'm still dreaming for official mpp "service loader" api. Clearly it's possible, just needs to be standardised
    p

    pererikbergman

    11 months ago
    @John O'Reilly I am curious about the use case.
    John O'Reilly

    John O'Reilly

    11 months ago
    One example might be some data you want to retrieve when app starts up
    r

    Rick Clephas

    11 months ago
    Not sure about iOS but for Android you could use a ContentProvider in the shared module.
    matej

    matej

    11 months ago
    @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.
    John O'Reilly

    John O'Reilly

    11 months ago
    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

    Rick Clephas

    11 months ago
    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…