Kotlin: using lateinit

Example:

class MyPresenter { lateinit var view: MyView }
The lateinit keyword allows you to initialize non-null properties outside the constructor.

Solution:

val presenter = MyPresenter() presenter.view = MyView()

Beginner's Guide to Kotlin