• Abstract away from UITableViewController and UICollectionViewController • Define views using Interface Builder and Auto Layout • Map data models to views used to display them, and view controllers to handle display and interaction
{ for section in backingSections { for object in section { let reuseIdentifier = reuseIdentifierForObject(object) if metricsCells[reuseIdentifier] == nil { if let metricsCell = createMetricsCellForObject(object) { metricsCells[reuseIdentifier] = metricsCell } } } } } }
protocol Media: Decodable { var title: String { get } var score: Int? { get } var releaseDate: NSDate { get } static func baseDecode(j: AnyObject) throws -> Base }
way to architect your app • Abstract away from UIKit APIs into more expressive logic • Define custom views, not custom cells • Allow for robust model display • Auto Layout is your friend