Slide 9
Slide 9 text
Benefits of MVVM
✓ View models are testable, no UI
automation required
✓ View models can do model-like
things (e.g., serialization)
9
Dienstag, 16. April 13
Traditionally, view controllers rarely get unit tested in Cocoa, simply because it’s such a pain to write a controller that doesn’t
depend on having a view (or, alternatively, to set up a valid view in unit tests). Since the VM doesn’t even know about view
objects, they can be tested without a GUI at all!
Serialization: for example, to save and restore the state of your UI, you can just save and restore your VM hierarchy. Doing this in
MVC would require a separate set of “view state” objects – which are basically view models anyways!