package com.yidianling.ydlcommon.custom.mvp

import com.yidianling.ydlcommon.custom.base.BaseFragment

/**
 * author : Zhangwenchao
 * e-mail : zhangwch@yidianling.com
 * time   : 2018/01/29
 *
 * 使用 mvp 的 Fragment
 */
abstract class MVPFragment<out P: MVPPresenter<*, *>>: BaseFragment(),
    MVPView {

    protected val presenter by lazy { createPresenter() }

    override fun onDestroy() {
        super.onDestroy()
        presenter.onViewDestroy()
    }

    protected abstract fun createPresenter(): P

}