Skip to content

Instantly share code, notes, and snippets.

@renaudcerrato
Last active February 19, 2019 12:29
Show Gist options
  • Save renaudcerrato/55a5bc59547de1332744fc40f7e7dcd0 to your computer and use it in GitHub Desktop.
Save renaudcerrato/55a5bc59547de1332744fc40f7e7dcd0 to your computer and use it in GitHub Desktop.
Kotlin LateInit
class Presenter {
lateinit var view: View
fun setup(_view: View) {
// ensure the lateinit var hasn't been initialized
if(this::view.isInitialized) throw IllegalStateException()
view = _view
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment