https://kotlinlang.org logo
#android
Title
# android
k

katien

12/20/2017, 11:47 PM
Copy code
interface BasePresenter<T> {
    var view: T?

    fun attachView(view: T) { this.view = view}
    fun detachView()  { this.view = null}
}
c

Casey Kulm

12/20/2017, 11:49 PM
Do you need the type parameters for the View. I typically only put them on the Presenter
k

katien

12/20/2017, 11:51 PM
I don't see how I'd define the attachView and detachView functions without a type parameter 😕
c

Casey Kulm

12/20/2017, 11:52 PM
Create an abstract class that implements the BasePresenter interface
That example I made is not fully fleshed out, so don’t completely follow it, but it might be able to get the idea across
k

katien

12/20/2017, 11:58 PM
hmm
this might be good
I will try it out and get back to you
thank you 🙂
5 Views