Displaying User Alerts

In this section, you are going to learn about user alerts and the different ways of configuring and displaying them. User alerts can provide your application with a better user experience, so you will use them fairly often.

Alerts are often used to warn users that an important action is about to happen and perhaps give them the opportunity to cancel that action. When you want to display an alert, you create an instance of UIAlertController with a preferred style. The two available styles are UIAlertControllerStyle.actionSheet and UIAlertControllerStyle.alert (Figure 11.9).

Figure 11.9  UIAlertController styles

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.