-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* We can call koin from swift * - implementation for #42 - Resolved the issue, with simple code!! --------- Co-authored-by: Rodrigo Varela <[email protected]>
- Loading branch information
Showing
7 changed files
with
56 additions
and
17 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import Foundation | ||
import presentation | ||
|
||
func get<A: AnyObject>() -> A { | ||
return DependenciesProviderHelper.companion.koin.get(objCClass: A.self) as! A | ||
} | ||
|
||
func get<A: AnyObject>(_ type: A.Type) -> A { | ||
return DependenciesProviderHelper.companion.koin.get(objCClass: A.self) as! A | ||
} | ||
|
||
func get<A: AnyObject>(_ type: A.Type, qualifier: (any Koin_coreQualifier)? = nil, parameter: Any) -> A { | ||
return DependenciesProviderHelper.companion.koin.get(objCClass: A.self, qualifier: qualifier, parameter: parameter) as! A | ||
} |
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
Binary file not shown.
36 changes: 36 additions & 0 deletions
36
...tion/src/iosMain/kotlin/network/bisq/mobile/presentation/di/DependenciesProviderHelper.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package network.bisq.mobile.presentation.di | ||
|
||
import kotlinx.cinterop.* | ||
import network.bisq.mobile.domain.di.domainModule | ||
import org.koin.core.Koin | ||
import org.koin.core.context.startKoin | ||
import org.koin.core.parameter.parametersOf | ||
import org.koin.core.qualifier.Qualifier | ||
|
||
class DependenciesProviderHelper { | ||
|
||
fun initKoin() { | ||
val instance = startKoin { | ||
modules(listOf(domainModule, presentationModule)) | ||
} | ||
|
||
koin = instance.koin | ||
} | ||
|
||
companion object { | ||
lateinit var koin: Koin | ||
} | ||
|
||
} | ||
|
||
@OptIn(BetaInteropApi::class) | ||
fun Koin.get(objCClass: ObjCClass): Any { | ||
val kClazz = getOriginalKotlinClass(objCClass)!! | ||
return get(kClazz, null, null) | ||
} | ||
|
||
@OptIn(BetaInteropApi::class) | ||
fun Koin.get(objCClass: ObjCClass, qualifier: Qualifier?, parameter: Any): Any { | ||
val kClazz = getOriginalKotlinClass(objCClass)!! | ||
return get(kClazz, qualifier) { parametersOf(parameter) } | ||
} |
10 changes: 0 additions & 10 deletions
10
...esentation/src/iosMain/kotlin/network/bisq/mobile/presentation/di/PresentationDIHelper.kt
This file was deleted.
Oops, something went wrong.