filmov
tv
SOLID Principles: Extract interface from class; use Koin to instantiate object of class using single

Показать описание
Start with an existing Service class that is passed into a ViewModel. Extract an interface from that service class and use that interface as a variable type, so that we can satisfy the Dependency Inversion and Interface Segregation SOLID princples. Next, register the concrete class in our Koin appModules file (modules bracket), and use the get() method in Koin to inject this Service class object into our ViewModel. This satisfies the Liskov Subsitution principle.