Make a Place to Play
You know the drill. Create a new project by following the steps for Create a Place to Play with Tests, but give it the name TextField. Delete its initial test file.
Let’s use the predefined storyboard-based view controller. Edit ViewController.swift, adding two text field outlets. We’ll use them to enter the username and password for a simple login simulation. Declare these outlets private(set) so that our tests can reach them:
|||@IBOutlet private(set) var usernameField: UITextField!|
|||@IBOutlet private(set) var passwordField: UITextField!|
We need something to serve as the delegate for the text fields. Let’s follow the common practice of using the view controller. ...