https://kotlinlang.org logo
k

katien

12/18/2017, 11:43 PM
I'm thinking it would be valuable to add a
BaseFragment
abstract class to handle setting a reference to the view on the presenter. I was imagining it would look something like this:
Copy code
abstract class BaseFragment : Fragment(), BaseView<BasePresenter<BaseFragment>> {

    override fun onViewCreated(view: View?, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        presenter.attachView(this)
    }

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