Upgrade to Pro — share decks privately, control downloads, hide ads and more …

MVVM & RAC

MVVM & RAC

Talk given at CocoaHeads Berlin April 2014

Demo project: https://github.com/stigi/mvvm-example

Ullrich Schäfer

April 16, 2014
Tweet

Other Decks in Programming

Transcript

  1. About Me! ! ! stigi " stigi # ullrich.is ||

    nslog.de || .com $ ullrich@ .com
  2. Where we come from – MVC Controller Model View Notify

    Update Update User Action (according to Apple)
  3. Reality • View controllers carry application logic! • And view

    controllers are part of the View! • shouldRotate, viewDidAppear, viewDidLayoutSubviews! • Views often know way to much about the model! • -[UITableViewCell configureWithObject:]! • -[PersonView initWithPerson:]
  4. Benefits • ViewController holds no application logic! • ViewModel does

    not know views! • ViewModel can be reused and extended! • Easy UI changes! • ViewModel is testable! • Easy migration, can co-exist with M–V–C
  5. What goes where Model View | ViewController ViewModel UIView, Nibs,!

    UIViewController,! DataSources ViewModel NSManagedObject,! API Controller,! … RAC RAC
  6. Take aways • You’re doing it wrong! • MVVM is

    Zen, give it a try! • MVVM & MVC can co-exists
  7. About Me! ! ! stigi " stigi # ullrich.is ||

    nslog.de || .com $ ullrich@ .com