package com.grkj.iscs_mc.view.base

import android.os.Bundle
import androidx.viewbinding.ViewBinding

/**
 * MVP基类Fragment
 */
abstract class BaseMvpFragment<V : IView?, T : BasePresenter<V>?, B : ViewBinding> : BaseFragment<B>(),
    IView {
    var presenter: T? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        presenter = initPresenter()
        presenter?.onCreate(this as V, this.context!!)
        super.onCreate(savedInstanceState)
    }

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

    /**
     * 实例化Presenter对象
     */
    abstract fun initPresenter(): T
}