0PricingLogin
SwiftUI Academy · Lesson

Alerts with Actions

Show alerts and respond to button taps.

What Is an Alert?

An alert is a small pop-up that grabs attention with a title, a message, and one or more buttons the user must respond to. ⚠️

Alerts Use a Boolean

Like sheets, an alert shows when a boolean state turns true. Store that flag in your view and flip it to trigger the pop-up.

@State private var showAlert = false

All lessons in this course

  1. Presenting a Sheet
  2. Detents & Drag Indicators
  3. Alerts with Actions
  4. Confirmation Dialogs
← Back to SwiftUI Academy