You can watch this episode by subscribing to Cocoacasts Plus.

Mastering MVVM With Swift

Supercharging MVVM With Protocols

Let's apply what we learned in the previous episodes to the week view controller. The week view controller currently configures the cells of its table view. That is something we want to change. The refactoring of the week view controller involves four steps. We create a view model for each table view cell. The WeekViewModel struct generates a view model for each table view cell. We define a protocol to which the view models for the table view cells conform. The WeatherDayTableViewCell class has the ability to configure itself using a view model.

Instant and Unlimited Access
to 400+ Cocoacasts Tutorials

Monthly

$19 / month

Pay Once a Month
Access to Community
30 Day Money Back Guarantee

Yearly

$8.25 / month (billed annually)

Pay Once a Year and Save $129
Access to Community
30 Day Money Back Guarantee
Access to All Books

Next Episode "Ready, Set, Test"