concept user in category swift

This is an excerpt from Manning's book Hello Swift!: iOS app programming for kids and other beginners.
Good graphics— Good graphics are one of the prime requirements for an app to become someone’s favorite. Users are more attracted to memorable, colorful graphics than black-and-white graphics (depending on the situation).
Computers also have some built-in parts, or devices attached to them, that help them get input from users and give the users output. A mouse, for example, is an input device; so are keyboards, cameras, and microphones. For output devices, think of printers, monitors, and speakers. Some devices can be both input and output devices. A touchscreen, for example, is both an input and an output device.
Listing 4.2. The code to add the userInput text field
import UIKit class ViewController: UIViewController { @IBOutlet var outputLabel: UILabel! //You added this earlier for your label. @IBOutlet var userInput: UITextField! #1 //This is what you'll link to the text field. override func view DidLoad() { super.viewDidLoad() outputLabel.text = "Hey, Frank!" //added 4.1 -- This is what the Label will say before you change it to what the user types. // Do any additional setup after loading the view, typically from a nib. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be re-created. } }

This is an excerpt from Manning's book iOS Development with Swift.
Sometimes, when you’re working on an application, you might make use of test data to get an idea of how the app will look in the real world after the user enters real data. Because this app is finished now, it’s time to remove this test data. See figure 1.18 to see how the first scene of the app looks with the test data, and how you want it to look when it’s published to the App Store.
Apps would be static, linear, and boring if the user couldn’t interact with them. In this chapter, we’ll look at three different ways an app can respond to user interaction:
Controls are special types of views that are built to receive user interaction. You’ve already seen one type of control in the distance converter app: the text field. In this chapter, you’ll extend the distance converter app to convert kilometers or miles that the user enters in the text fields, by adding buttons and responding to changes in the text fields. Finally, we’ll look at other available controls for receiving user interaction.
Add a handleTap() action method that will be triggered when the user taps the image. The method increments the image number by 1 and returns it to 0 if it reaches the upper limit of elements in the images array. It then replaces the image in the image view with the next image in the array, as shown in the following code. (You could add a fancy transition here, but let’s not complicate things too soon—all in good time!) Now, to create the gesture recognizer itself. Every gesture recognizer is instantiated with two parameters, as shown in table 5.6.@objc func handleTap(_ sender: UITapGestureRecognizer) { imageNo += 1 if imageNo == images.count {imageNo = 0} imageView.image = UIImage(named: images[imageNo]) }
Parameter
Description
target Specifies the object to receive any gesture events, which in this case will be self—the view controller. action Specifies the method to receive notification of the gesture event. You set up the handleTap() method to receive these notifications. The action is specified using a special expression called #selector. Use #selector to pass in the name of the method. Because the #selector expression uses the Objective-C runtime to connect to the associated method, the method will need to be exposed with the @objc keyword.
You’ll use system buttons to make your distance converter app interactive. The user can convert the number of miles they’ve entered to kilometers or vice versa (see figure 5.2). Okay, we’re not going to win any design awards, but we’re focused on functionality for the moment.