Presentation of popover, confirmationDialog, sheet and fullScreenCover are all broken

Originator:indiekiduk
Number:rdar://FB12078831 Date Originated:2023-03-24
Status:Open Resolved:No
Product:SwiftUI Product Version:iOS 16.4 RC
Classification:Bug Reproducible:Always
 
I've been following the issue with sheets for a while and I noticed in the iOS 16.4 RC release notes, the following:
"Fixed: Presentations in SwiftUI using the ‘sheet’ or ‘fullScreenCover’ modifier can now be dynamically presented again while a dismiss animation is in progress. Previously, attempting to present again in this case would do nothing."

I decided to make a test app to try this out and have uncovered a wider issue with presentation in SwiftUI. If one type of thing is being presented, e.g. a popover, then when attempting another kind of presentation, e.g. a confirmationDialog, then the second thing does not present and the is broken and never presents again. It seems the fix that is mentioned in the release notes needs generalised to all different kinds of presentations.

I've attached a sample application "BrokenPresentation" to demonstrate the problem. Please launch this on the iPad Pro 11-inch 4th gen simulator. 

Launch 1
Click popover.
While popover is still presented, now click sheet.
Although the popover is dismissed, the sheet does not present. Furthermore clicking sheet again still does not present it.

Click popover again
While popover is still presented, now click Confirmation Dialog
Although the popover is dismissed, the dialog does not present. Furthermore clicking Confirmation Dialog again still does not present it.

Repeat this again for full screen cover.

As you can see there is a serious problem with different kinds of presentation in SwiftUI, I hope this can be fixed.

Xcode Version 14.3 RC
iOS 16.4 RC

Code from attached sample project pasted below for openradar:

import SwiftUI

struct ContentView: View {
    @State var popoverPresented = false
    @State var confirmationPresented = false
    @State var sheetPresented = false
    @State var fullScreenCoverPresented = false
    
    var body: some View {
        VStack {
            Spacer()
            Button("Popover") {
                popoverPresented = true
            }
            .popover(isPresented: $popoverPresented) {
                Text("Popover")
            }
            Spacer()
            Button("Sheet") {
                sheetPresented = true
            }
            .sheet(isPresented: $sheetPresented) {
                Text("Sheet")
            }
            Spacer()
            Button("Confirmation Dialog") {
                confirmationPresented = true
            }
            .confirmationDialog(
                "Confirmation dialog",
                isPresented: $confirmationPresented,
                titleVisibility: .visible
            ) {
                Button("button") {}
            } message: {
                VStack {
                    Text("Message")
                }
            }
            
            Spacer()
            Button("Full Screen Cover") {
                fullScreenCoverPresented = true
            }
            .fullScreenCover(isPresented: $fullScreenCoverPresented) {
                Text("Full Screen Cover")
                Button("Dismiss") {
                    fullScreenCoverPresented = false
                }
            }
            Spacer()
        }
    }
}

Comments

Still broken on:

Xcode Version 15.1 beta (15C5028h) iOS 17.0 (21A326) SDK + iOS 17.0 (21A328) Simulator (Installed)

I was wondering if the potential fix for future OS update will be a minor of 17 or if I have to wait for 18? Thanks

By indiekiduk at Oct. 4, 2023, 4:12 p.m. (reply...)

Issue still exists Xcode: Version 15.0 beta (15A5160n) Simulator: iPad Pro (12.9-inch) (6th generation) iOS 17.0 (21A5248u)

By indiekiduk at June 12, 2023, 4:46 p.m. (reply...)

Please also see FB11991898 "Sheet does not appear when triggered while a popover is visible"

By indiekiduk at March 25, 2023, 9 a.m. (reply...)

Menu is also affected, please see FB12026200

By indiekiduk at March 25, 2023, 9 a.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!