Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not possible to add non-Android module to Android Koin #29

Closed
Unlimity opened this issue Dec 17, 2017 · 5 comments
Closed

Not possible to add non-Android module to Android Koin #29

Unlimity opened this issue Dec 17, 2017 · 5 comments
Assignees
Milestone

Comments

@Unlimity
Copy link

Hi there! Thanks for your hard work on Koin! Great library.
Anyway, I faced an issue, where you force to provide list of AndroidModule's to Application.startKoin(). Thus it is impossible to provide modules that are built, for example, in data or domain layers, which are usually written without platform dependencies.
Briefly looking through your code, I haven't found any serious reason to force AndroidModule for android artifact. What do you think? This will be a big win, if your android artifact's startKoin function will accept all descendants of Module.

@arnaudgiuliani
Copy link
Member

Hello,

Koin 0.7.0 brings a better DSL and Koin modules won't have any dependency with Android classes. Up to you to inject Application/Context dependencies or not.

The startKoin() from 0.7.0 will accept Modules as you pointed, allowing to build fully independent modules for Android.

Wait the next days, for the next release (hope to release it before xmas :) )

@arnaudgiuliani arnaudgiuliani added this to the 0.7.0 milestone Dec 18, 2017
@arnaudgiuliani arnaudgiuliani self-assigned this Dec 18, 2017
@Unlimity
Copy link
Author

Great news!
BTW, could you specify a bit how the system will behave in that way. Are non android modules will be bound to application? Or they will live forever?
And how I understand it, sub context dependencies will still be able to cleared even if they are not in android module, right?

@arnaudgiuliani
Copy link
Member

AndroidModule only give you some shortcuts to inject Application instance (the androidApplication property). this will be available again, with a classic injection (get())

Sub context is a core feature. You can drop context even if you are not in an Android app.

@arnaudgiuliani
Copy link
Member

I'm working on a new website to give better documentation. Check insert-koin.io next days or our twitter account : @insertkoin_io

@arnaudgiuliani
Copy link
Member

You can check the Koin 0.7.1 on https://insert-koin.io

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants