Hey , I need some hlep, using Koin annotations, wh...
# koin
i
Hey , I need some hlep, using Koin annotations, what annotation do I need for set for interface definitions and concrete platform implmenattions?
Eg.. interface LocationService {}
class AndroidLocationService(): LocationService {}
a
You can either create a class, mark it with @Module annotation, then inside this class define a function annotated with @Single or @Factory which will return the interface but the function body would be the concreete implementation, then pass this module to the startKoin, or annotate the concrete class with @Single or @Factory and pass a parameter to the annotation binds = Interface::class, the second will add the definition to the default module, which also should be passed to startKoin. This two are most common.
🙌 1