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
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!
5th July 2024
I see in the 17.4 release notes this was fixed, I will close this issue now. Please could you double check this fix made it into iOS 18 because I see strange issues with alert in beta 2 FB14155015
https://developer.apple.com/documentation/ios-ipados-release-notes/ios-ipados-17_4-release-notes Resolved Issues * Fixed: Resolved an issue with programmatically present an alert or sheet simultaneously with dismissing another sheet. The new alert or sheet would not show but now it will. If you have code that presents the same sheet programmatically from multiple places in your view hierarchy at the same time, that sheet might no longer appear. Make sure that any sheet modifiers that are in the view hierarchy at the same time use distinct isPresented or item bindings. (117475214)
1st April 2024
This seems fixed when I tested it on 17.4. Please could you let me know if that is correct and it would be helpful to know which minor version of 17 it was fixed in. Thanks
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
Issue still exists Xcode: Version 15.0 beta (15A5160n) Simulator: iPad Pro (12.9-inch) (6th generation) iOS 17.0 (21A5248u)
Please also see FB11991898 "Sheet does not appear when triggered while a popover is visible"
Menu is also affected, please see FB12026200