Chapter 16

Using Properties, Variables, Outlets, and Actions

In This Chapter

arrow Using properties to store values

arrow Adding interface outlets

arrow Connecting an action to a button

In Chapter 15, you see how to declare classes (and, along with them, the basics of enumerations and structures that share many of the class features except for inheritance). In this chapter, the focus is on properties and variables, which are where your data is stored, as well as on outlets and actions, which are the user interface elements of your app. (Most of the time, outlets and actions are created in storyboards and the links between the graphical user interface of a storyboard and your Swift code consist of outlets and actions.)

You’ve seen these elements in action in other chapters, but now it’s time to focus on the details.

The code for this chapter can be downloaded as described in the Introduction. Just as a reminder, it’s the Locatapp based on the Master-Detail Application template. Its basic functionality lets the user create new event locations with the + at the top right of the master detail view controller. The user’s location is shown on the detail view controller. The screenshots in this chapter ...

Get Swift For Dummies 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.