Skip to content

AlertState renders empty content inside fullScreenCover (swift-navigation >= 2.9.1) #371

Description

@andre-moneyforward

Description

When presenting an alert using AlertState in swift-navigation v2.9.1 or higher, the alert content (title, message, and custom buttons) is omitted. Instead, an empty default alert with only an "OK" button is displayed.

  • Works in: v2.8.0, v2.9.0
  • Broken in: v2.9.1 and later

Code Example

AlertState Configuration

AlertState(
    title: {
        TextState("Title")
    },
    actions: {
        ButtonState(role: .cancel) { TextState("Cancel") }
        ButtonState(role: .destructive, action: .close) { TextState("Discard") }
    },
    message: {
        TextState("Message")
    }
)

View Hierarchy

var body: some View {
    TabView {
        VStack {
            Text("Tab 1")
            Button("Show Dummy View") {
                viewModel.showDummyView()
            }
        }
        .tabItem { Text("Tab 1") }

        VStack {
            Text("Tab 2")
            Button("Show Dummy View") {
                viewModel.showDummyView()
            }
        }
        .tabItem { Text("Tab 2") }
    }
    .fullScreenCover(item: $viewModel.destination.dummy) { dummyViewModel in
        NavigationStack {
            DummyView(viewModel: dummyViewModel)
                .toolbar {
                    ToolbarItem(placement: .cancellationAction) {
                        Button {
                            viewModel.closeButtonTapped()
                        } label: {
                            Image(systemName: "xmark")
                        }
                    }
                }
                .alert(
                    $viewModel.overlay.closeConfirmAlert, 
                    action: viewModel.closeAlertButtonTapped
                )
        }
    }
}

Checklist

  • I have determined whether this bug is also reproducible in a vanilla SwiftUI project.
  • If possible, I've reproduced the issue using the main branch of this package.
  • This issue hasn't been addressed in an existing GitHub issue or discussion.

Expected behavior

The alert should display the custom title ("Title"), message ("Message"), and actions ("Cancel" and "Discard" buttons) configured in AlertState.

Simulator.Screen.Recording.-.iPhone.17.-.2026-08-14.at.14.01.32.mov

Actual behavior

The alert displays with no title, no message, and a single default "OK" button.

Simulator.Screen.Recording.-.iPhone.17.-.2026-08-14.at.13.59.19.mov

Steps to reproduce

I've attached the project to reproduce the issue.
The issue occurs on swift-navigation >= v2.9.1

  1. Tap Show Dummy View
  2. Tap Close Button

SampleNavigationAlertBug.zip

SwiftUI Navigation version information

>=2.9.1

Destination operating system

iOS 26.5

Xcode version information

XCode 26.5

Swift Compiler version information

6.3.2

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions