Interactive previews iPhone

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.

Message Item 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
struct Item {
    let message: String
}

@State var item: Item? = .init(message: "Foo")

var body: some View {
    Text("Foo")
        .alert("Title", item: $item) { alertItem in
            Button("Ok") {
                print("Item nilled")
            }
        } message: { alertItem in
            Text(alertItem.message)
        }
}

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.

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.

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

Error Alert

Presents an alert when an error is present.

Explore Other Components

Browse all
Menu Divider - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
content

Menu Divider

A Menu with a Divider

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

CircularProgressViewStyle

The style of a progress view that uses a circular gauge to indicate the partial completion of an activity

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

AccessoryCircularCapacityGaugeStyle

A gauge style that displays a closed ring that’s partially filled in to indicate the gauge’s current value

Menu Section - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
content

Menu Section

A Section inside a Menu

Menu - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Menu

A control for presenting a menu of actions.

Current Value Gauge  - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Current Value Gauge

Creates a gauge showing a value within a range and that describes the gauge’s purpose and current value

Content Unavailable Search Text - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
type

Content Unavailable Search Text

A pre-built placeholder for empty search results with search text

Gauge - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Gauge

Creates a gauge showing a value within a range and describes the gauge’s purpose and current value