注入类型化的演示者导致错误(moxy)
Inject typed presenter cause error (moxy)
我的主持人是:
@InjectViewState
class SearchPresenter<T>(val network: Network) : BasePresenter<SearchView<T>>() {
//pass
}
T - 要传递的数据类。 Т 可能是 5 种数据中的一种 class не 没有相互 parents
数据class 类型对于注入演示者的片段是已知的
我如何与片段之一的演示者一起工作:
class SearchNewsFragment : SearchBaseFragment(), NewsView<NewsShortEntity> {
@InjectPresenter
lateinit var presenter: SearchPresenter<NewsShortEntity>
@ProvidePresenter
fun provideSearchPresenter(): SearchPresenter<NewsShortEntity> {
return SearchPresenter(network)
}
查看:
interface NewsView<T> : SearchView<T> {
//pass
}
我收到了什么:
error: You can not use @InjectPresenter in classes that are not View,
which is typified target Presenter public
SearchPresenter
presenter;
如何赢得这场比赛?
尝试改变
class SearchPresenter<T>(val network: Network) : BasePresenter<SearchView<T>>()
至
class SearchPresenter<T>(val network: Network) : BasePresenter<NewsView<T>>()
我的主持人是:
@InjectViewState
class SearchPresenter<T>(val network: Network) : BasePresenter<SearchView<T>>() {
//pass
}
T - 要传递的数据类。 Т 可能是 5 种数据中的一种 class не 没有相互 parents
数据class 类型对于注入演示者的片段是已知的
我如何与片段之一的演示者一起工作:
class SearchNewsFragment : SearchBaseFragment(), NewsView<NewsShortEntity> {
@InjectPresenter
lateinit var presenter: SearchPresenter<NewsShortEntity>
@ProvidePresenter
fun provideSearchPresenter(): SearchPresenter<NewsShortEntity> {
return SearchPresenter(network)
}
查看:
interface NewsView<T> : SearchView<T> {
//pass
}
我收到了什么:
error: You can not use @InjectPresenter in classes that are not View, which is typified target Presenter public SearchPresenter presenter;
如何赢得这场比赛?
尝试改变
class SearchPresenter<T>(val network: Network) : BasePresenter<SearchView<T>>()
至
class SearchPresenter<T>(val network: Network) : BasePresenter<NewsView<T>>()