Of using expect/actual to provide per platform module definitions that can be pulled in and included as well (used for example for settings and for One last note - the KaMPKit project mentioned earlier also has nice example To PeopleInSpace repo containing these changes. fun initKoin ( appDeclaration : KoinAppDeclaration = Next, we added Koin.kt containing following to common code. implementation ( "org.koin:koin-core:3.0.0-alpha-2" ) So, first thing needed was to add following to commonMain dependencies section in in the common module. PeopleInSpaceRepository is being used directly by the Kotlin/Native clients we have (iOS, watchOS, macOS) and, up to now, had directly instantiated PeopleInSpaceApi but with these changes we can now add that as an injected dependency. The Android app module had already been using Koin and had previously wired up a dependency from PeopleInSpaceViewModel to PeopleInSpaceRepository. PeopleInSpace is by definition very minimal so the number of dependencies we need to wire up is pretty small. I should mention at this point that Touchlab, who were actually co-developers of this capability in the library, areĪlso using it in their KaMPKit project so would definitely recommend looking at that as well. Version in the common kotlin code module and am going to outline below the steps that were required. I’ve made the necessary updates to the PeopleInSpace project to start using this Just unlocked Koin Multiplatform (3.0.0-alpha-2) - setup page: Arnaud Giuliani May 15, 2020
0 Comments
Leave a Reply. |