Alerts and Action Sheets
Alerts and action sheets are system-provided, full-screen modal interfaces that help you give people critical information they need right now. An alert lets you display errors or other important information related to the state of your app and its activities. An action sheet lets you prompt people to choose from a small set of possible options.
Use alerts and action sheets sparingly. Alerts and action sheets give people important information and choices, but they interrupt the current task to do so. To encourage people to pay attention to your alerts and action sheets, avoid using them more than necessary.
The system defines two styles for alerts and one style for action sheets. All three modal interfaces include a title, an optional message, and one or more buttons. The appearance of these modal interfaces is different, depending on the device.
Each button in an alert or action sheet has an associated style that conveys information about the button’s effect. There are three system-defined button styles:
|Default||The button has no special meaning|
|Destructive||The button destroys user data or performs a destructive action in the app|
|Cancel||The button dismisses the view without taking any action|
Use a one-button alert when it’s crucial to tell people about an error or unusual condition in your app. The alert’s title and optional message should describe the precise nature of the problem. The single button uses the default style and always dismisses the alert.
Use a side-by-side button alert when you need to offer people two options for handling an error or unusual condition in your app. In a side-by-side button alert, the title and optional message should describe the precise nature of the situation and the choice that people can make. A side-by-side alert also includes exactly two buttons: one button that initiates the action described in the text and one button that lets people dismiss the alert without taking the action. For example, side-by-side alerts often include OK and Cancel buttons. The button that initiates the action should use either the default or destructive style, depending on its effect. The dismiss button should always use the cancel style.
Use an action sheet to let people choose how your app should proceed in the current situation. Use the title and optional message to help people understand the situation and their choices. In addition to a button that cancels the action (which always appears in the upper-left corner of the sheet), you can give people up to about three choices.
Avoid including more than four buttons in an action sheet. When there are fewer buttons onscreen, it’s easier for people to view all their options at once. Because one of the buttons must cancel the action, it’s best to give people no more than three additional choices.
Always include a Cancel button in a side-by-side alert or action sheet. People should always have a way to dismiss these views without taking further action. Although you can use a custom title in place of Cancel, the button should use the cancel style.
For developer guidance, see WKAlertAction.
Title and Message Text
Be succinct. The title should clearly and concisely explain what happened or what action is necessary. In alerts, you might use the optional message to provide brief details about what happened or, in a side-by-side button alert, you might use it to give people more context for their choice.
Aim to keep titles short enough to display on a single line. A long title is difficult to read quickly and might get truncated or require people to scroll. Short titles are easier to read and leave more room for a message and buttons.
If a short title conveys the right information, consider omitting the message. In an alert, include a message only if it adds value. Action sheets should rarely need a message.
Use capitalization and punctuation as recommended. Use the following scenarios for guidance.
|Sentence fragment or single sentence that's not a question||Title-style capitalization and no ending punctuation|
|Single sentence that's a question||Sentence-style capitalization and an ending question mark|
|Two or more sentences||Sentence-style capitalization and appropriate ending punctuation for each sentence|