Imagine that we are developing a bank system for working with multi-currency accounts:
interface Wallet
class UsdWallet: Wallet
class BtcWallet: Wallet
These components are injected in this way:
class UsdAccount : KoinComponent {
private val wallet: Wallet by inject(named<UsdWallet>())
}
class BtcAccount : KoinComponent {
private val wallet: Wallet by inject(named<BtcWallet>())
}
Write the code that will make the Wallet component with the BtcWallet implementation type-named:
val appModule = module {
// UsdWallet already declared
factoryOf(::BtcWallet) {
bind<Wallet>()
// you code here
}
}