A scene to add supplies

Starting with the option to add supplies, we create a new file in the project called AddSuppliesViewController.swift. Start importing UIKit and creating a class that inherits from UIViewController with the same name as the file. This class will also work with UIPickerView, which implies that we have to implement the UIPickerViewDataSource and UIPickerViewDelegate protocols. We will also need to implement UITextFieldDelegate. Leave this class empty for now; don't worry about the compiler errors:

class AddSupplyViewController: UIViewController, UIPickerViewDataSource, UIPickerViewDelegate, UITextFieldDelegate
{
}

Return to the storyboard and add a new view controller to it. Connect the AddSupply button from the first scene ...

Get Swift 2 Blueprints 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.