I found a SwiftUI presentation bug with multiple alerts and sheet presentations. I submitted a Feedback Assistant report too: Feedback ID: FB24621651
The issue is that a native SwiftUI alert dismisses immediately after appearing when it is presented from a view inside a nested sheet.
Minimal hierarchy:
TabView
-> NavigationStack
-> outer sheet
-> NavigationStack
-> detail view
-> inner sheet
-> alert
The inner sheet contains a normal button:
struct InnerSheetRoot: View {
@State private var showAlert = false
var body: some View {
Button("Show Alert") {
showAlert = true
}
.alert("Alert from inner sheet", isPresented: $showAlert) {
Button("OK") {}
} message: {
Text("This alert should remain visible.")
}
}
}
Steps to reproduce
- Open the attached sample project.
- Select the Storage tab.
- Tap any storage row.
- In the outer sheet, tap Open Inner Sheet.
- In the inner sheet, tap Show Alert.
Actual result
The alert appears briefly and dismisses immediately. It may disappear before OK can be tapped.
Expected result
The alert should remain visible until the user taps OK.
The issue disappears when I remove either the root TabView or the second NavigationStack. It also disappears when the inner sheet is removed.
Environment:
Xcode: Xcode 26.6
macOS: macOS 26.6.2
iOS: iOS 26.5
Device or simulator: iPhone Simulator
Deployment target: iOS 26.0
Swift version: Swift 6
The example project and a screen recording are attached to the Feedback Assistant report, but they can also be found here.
I would appreciate confirmation of whether this is a known SwiftUI presentation-host issue and whether there is a recommended way to present alerts from content inside nested sheets.
Thank you for the update @FMDRE
The fix is implemented moving forward in 27 versions. As a workaround in previous versions, try flattening the presentation depth by driving the alert from the outer sheet's root, instead of the innermost. Then have the inner sheet set a @Binding/environment that reads the value from the outer sheet to trigger its own .alert
Travis