-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Presenter 怎么注入的,注入对象的来源 #173
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Presenter 怎么注入的 ?
A:
Presenter
的注入通过Inject
方式注入,位置是BaseActivity
,类型是泛型IPresenter
及其子类(因为BaseActivity是抽象类,无法实例化,所以实际是在子实现类中)
Presenter 注入对象的来源 ?
A:以框架中
UserPresenter
为例子 红色的在UserModule
蓝色的在AppComponent
接口实现类DaggerAppComponent
中userModule
AppComponent
接口实现类DaggerAppComponent
中具体Dagger的用法和理解请参考文档:
基础篇:Dagger2 学习
Dagger2 Scope 注解
原理篇:扔物线 Dagger 精解
基础篇是
MVVMArms
的作者写的,作为基础篇个人感觉不错。就是Scope那个地方说的不清楚,所以加上了第二篇。第三篇是扔物线
写的关于Dagger1的原理的,虽然是Dagger1的,但是个人认为该文是了解Dagger的原理,思想的最好的一篇文章。The text was updated successfully, but these errors were encountered: