This file contains hidden or 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 { | |
| factoryOf(::StaffListerImpl) bind StaffLister::class | |
| factoryOf(::SearchBox) | |
| } |
This file contains hidden or 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 { | |
| factory { StaffListerImpl() as StaffLister } | |
| factory { SearchBox (get()) } | |
| } |
This file contains hidden or 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
| class CheckModulesTest : KoinTest { | |
| @Test | |
| fun verifyKoinApp() { | |
| koinApplication { | |
| modules(module1, module2) | |
| checkModules() | |
| } | |
| } | |
| } |
This file contains hidden or 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
| struct ContentView: View { | |
| let staff = SearchBoxHelper().findByName(name: "Pamela Hill") | |
| var body: some View { | |
| Text(staff) | |
| } | |
| } |
This file contains hidden or 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
| import org.koin.core.component.KoinComponent | |
| import org.koin.core.component.inject | |
| ... | |
| class SearchBoxHelper : KoinComponent { | |
| private val searchBox : SearchBox by inject() | |
| fun findByName(name: String) : String = | |
| searchBox.findStaffMemberByName(name).toString() | |
| } |
This file contains hidden or 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
| import org.koin.android.ext.android.inject | |
| ... | |
| class MainActivity : AppCompatActivity() { | |
| private val searchBox: SearchBox by inject() | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| setContentView(R.layout.activity_main) |
This file contains hidden or 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
| @main | |
| struct iOSApp: App { | |
| init() { | |
| HelperKt.doInitKoinApp() | |
| } | |
| … | |
| } |
This file contains hidden or 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
| fun initKoinApp(){ | |
| initKoin() | |
| } |
This file contains hidden or 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
| class MyApplication : Application() { | |
| override fun onCreate() { | |
| super.onCreate() | |
| initKoin() | |
| } | |
| } |
This file contains hidden or 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
| import org.koin.core.KoinApplication | |
| import org.koin.core.context.startKoin | |
| import org.koin.core.module.Module | |
| import org.koin.dsl.module | |
| ... | |
| object Modules { | |
| val appModule = module { | |
| factory { StaffListerImpl() as StaffLister } | |
| factory { SearchBox (get()) } |
NewerOlder