Exposing the Properties of ItemCell

For ItemsViewController to configure the content of an ItemCell in tableView(_:cellForRowAt:), the cell must have properties that expose the three labels. These properties will be set through outlet connections in Main.storyboard.

The next step, then, is to create and connect outlets on ItemCell for each of its subviews.

Open ItemCell.swift and add three properties for the outlets.

import UIKit

class ItemCell: UITableViewCell {

    @IBOutlet var nameLabel: UILabel!
    @IBOutlet var serialNumberLabel: UILabel!
    @IBOutlet var valueLabel: UILabel!

}

You are going to connect the outlets for the three views to the ItemCell. When connecting outlets earlier in the book, you Control-dragged from view controller ...

Get iOS Programming: The Big Nerd Ranch Guide, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.