---
title: AlertScene
framework: swiftui
role: symbol
role_heading: Structure
path: swiftui/alertscene
---

# AlertScene

A scene that renders itself as a standalone alert dialog.

## Declaration

```swift
nonisolated struct AlertScene<Actions, Message> where Actions : View, Message : View
```

## Overview

Overview Alert scenes present themselves in the center of the current display, and don’t attach to any particular window. The system prevents interaction with the app until someone dismisses the alert scene. @main struct MyApp: App {     @State var showLoginAlert = true     @State var loggedIn = false

var body: some Scene {         Window("Welcome User Window", id:"WelcomeWindow") {             ...         }         .defaultLaunchBehavior(loggedIn ? .presented : .suppressed)

AlertScene("Login Required", isPresented: $showLoginAlert) {             Button("OK") {                 ...             }         }     } } All the actions you provide in the ContentBuilder dismiss the alert when someone invokes them. Like the alert modifier, specify the role of the buttons with cancel or destructive. If you don’t provide any actions, the system automatically includes a button with the title “OK” that dismisses the alert scene.

## Topics

### Initializers

- [init(_:isPresented:actions:)](swiftui/alertscene/init(_:ispresented:actions:).md)
- [init(_:isPresented:actions:message:)](swiftui/alertscene/init(_:ispresented:actions:message:).md)
- [init(_:isPresented:presenting:actions:)](swiftui/alertscene/init(_:ispresented:presenting:actions:).md)
- [init(_:isPresented:presenting:actions:message:)](swiftui/alertscene/init(_:ispresented:presenting:actions:message:).md)
- [init(_:item:actions:)](swiftui/alertscene/init(_:item:actions:).md)
- [init(_:item:actions:message:)](swiftui/alertscene/init(_:item:actions:message:).md)

## Relationships

### Conforms To

- [Scene](swiftui/scene.md)

## See Also

### Presenting an alert

- [alert(_:isPresented:actions:)](swiftui/view/alert(_:ispresented:actions:).md)
- [alert(_:isPresented:presenting:actions:)](swiftui/view/alert(_:ispresented:presenting:actions:).md)
- [alert(_:item:actions:)](swiftui/view/alert(_:item:actions:).md)
- [alert(error:actions:)](swiftui/view/alert(error:actions:).md)
- [alert(isPresented:error:actions:)](swiftui/view/alert(ispresented:error:actions:).md)
- [alert(_:isPresented:actions:message:)](swiftui/view/alert(_:ispresented:actions:message:).md)
- [alert(_:isPresented:presenting:actions:message:)](swiftui/view/alert(_:ispresented:presenting:actions:message:).md)
- [alert(_:item:actions:message:)](swiftui/view/alert(_:item:actions:message:).md)
- [alert(error:actions:message:)](swiftui/view/alert(error:actions:message:).md)
- [alert(isPresented:error:actions:message:)](swiftui/view/alert(ispresented:error:actions:message:).md)
