Interactive previews iPhone

Error Alert

Presents an alert when an error is present.

Error Alert - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview

Platform Compatibility

iOS 27.0+ iPadOS 27.0+ macOS 27.0+ watchOS 27.0+ tvOS 27.0+ visionOS 27.0+

Tags

SwiftUI Code

Docs
enum FooError: LocalizedError {
    case bar

    var errorDescription: String? {
        switch self {
            case .bar:
            return "Bar error occurred."
        }
    }
}

@State private var error: FooError? = .bar

var body: some View {
    Text("Foo")
        .alert(error: $error) {
            Button("OK") {
                print("Error nilled")
            }
        }
}

Found an issue or have a suggestion?

Created: June 9, 2026Updated: June 9, 2026
Connect Wizard

Connect Wizard

Unlock insights App Store Connect doesn’t show you.

Get Started

More Alert Components

View all
Message Error Alert - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
modifier

Message Error Alert

Presents an alert with a message when an error is present.

Message Item Alert - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
modifier

Message Item Alert

Presents an alert with a message using the given data to produce the alert’s content and a localized string key for a title.

Item Alert - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
modifier

Item Alert

Presents an alert using the given data to produce the alert’s content and a text view as a title.

Explore Other Components

Browse all
 LinearGaugeStyle - iOS on iPhone - Portrait - Flat Design - Light Mode - Preview
style

LinearGaugeStyle

A gauge style that displays a bar with a marker that appears at a point along the bar to indicate the gauge’s current value

Value Tab View - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
modifier

Value Tab View

Creates a tab view that uses a builder to create and specify selection values for its tabs.

Overlay Arrangement Style - iOS on iPhone Duo - Landscape - Fully Open - Liquid Glass - Light Mode - Preview
style

Overlay Arrangement Style

An arrangement view style that layers the primary view over the secondary view in z-order.

Hinge State - iOS on iPhone Duo - Landscape - Fully Open - Liquid Glass - Light Mode - Preview
structure

Hinge State

A type encapsulating the state of a single hinge.

Default Adaptable Tab Bar Placement - iPadOS - Landscape - Liquid Glass - Light Mode - Preview
modifier

Default Adaptable Tab Bar Placement

Specifies the default placement for the tabs in a tab view using the adaptable sidebar style.

Custom Phases Async URL Image - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Custom Phases Async URL Image

Loads and displays a modifiable image from the specified URL load request in phases.

CompactProductViewStyle - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
style

CompactProductViewStyle

A style for a product view that’s suitable for layouts with less available space, or for displaying more items in a small amount of space.

Tab View Customization - iPadOS - Landscape - Liquid Glass - Light Mode - Preview
modifier

Tab View Customization

Specifies the customizations to apply to the sidebar representation of the tab view.