I don't think this is right though...
# android
k
I don't think this is right though...
k
@katien It get’s tricky because of the strict generic rules. I have something very similar to this. To make it work, you’d have to do something like this:
Copy code
abstract class BaseFragment<V: BaseView, out P: BasePresenter>: Fragment(), BaseView {

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
@Suppress("UNCHECKED_CAST")
presenter.attachView(this as V)
}

override fun onDestroyView() {
super.onDestroyView()
presenter.detachView()
}
}