DEV Community

Discussion on: Humble Views, Proud ViewModels

Collapse
 
marcellogalhardo profile image
Marcello Galhardo • Edited

Hey, @_anpurnama , glad to hear that. 😄

Definitely! The same example with activities would look like the following:

class SignUpActivity : AppCompatActivity() {

    private val viewModel by TODO("ViewModel declaration")

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        val view = SignUpView(this)

        // Bind the View and ViewModel

        setContentView(view)
    }
}
Enter fullscreen mode Exit fullscreen mode

All other aspects are the same.