Created
November 7, 2020 20:57
-
-
Save skywall/87c2289bdc6f7ae0a8bac8fe2f05e249 to your computer and use it in GitHub Desktop.
Injection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Module | |
class TicketMachineModule { | |
@Provides | |
@Singleton | |
fun printer(display: Display) = Printer(display) | |
@Singleton | |
@Provides | |
fun display(): Display = Display() | |
@Singleton | |
@Provides | |
fun coinCounter(): CoinCounter = CoinCounter() | |
} | |
@Singleton | |
@Component(modules = [ | |
TicketMachineModule::class | |
]) | |
interface TicketMachineComponent { | |
val ticketMachine: TicketMachine | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment