Tying the iOS app together with the shared code
If you try to subscribe to the breeds
stream from the BreedsRepository
repository, you'll see that you can't really initialize this repository from the iOS code. This is because we've made a mistake—we don't really want to deal with Koin from Swift, so we could just migrate to a similar injection pattern that we've used for the use cases, as illustrated in the following code snippet:
class BreedsRepository: KoinComponent { private val remoteSource: BreedsRemoteSource by inject() private val localSource: BreedsLocalSource by inject()
Now, if you try to call some of our use cases, you can see that you can call suspend functions, as illustrated in the following screenshot, and you'll get back a CompletionHandler
, since Kotlin 1.4:
Now, there...