Sheet Display Error When Picker Open

When a Picker is showing, if you tap on a button outside the Picker view that shows a Sheet, the sheet fails to show and subsequently showing any sheet will fail until you restart the app. This only happens when the button that shows the sheet is too close to the bottom of the screen. If you provide some space between the bottom of the button and the screen (i.e. 50 Points), there is no longer an issue.

I reproduced this with Xcode 14.2 on an iPhone Xs (iOS 16.1.1) and the iPhone 14 Sim (iOS 16.2). It does not occur when testing with Playgrounds.

The error:

[Presentation] Attempt to present <TtGC7SwiftUI29PresentationHostingControllerVS_7AnyView: 0x7fae7585de00> on <TtGC7SwiftUI19UIHostingControllerGVS_15ModifiedContentVS_7AnyViewVS_12RootModifier_: 0x7fae76011800> (from <TtGC7SwiftUI19UIHostingControllerGVS_15ModifiedContentVS_7AnyViewVS_12RootModifier_: 0x7fae76011800>) which is already presenting <_UIDatePickerContainerViewController: 0x7fae756b0f00>.

import SwiftUI

struct ContentView: View {
    
    @State private var showSheet = false
    @State var selectedDate: Date = Date()
    
    var body: some View {
        VStack {
            DatePicker(selection: $selectedDate) {
                Text("Select Date")
            }
            Spacer()
            HStack {
                Button {
                    showSheet = true
                } label: {
                    Text("Show Sheet Working")
                        .background(Color.green)
                }
                .offset(.init(width: 10.0, height: -45.0))
                Button {
                    showSheet = true
                } label: {
                    Text("Show Sheet Broken")
                        .background(Color.red)
                }
                .offset(.init(width: 10.0, height: -35.0))
            }
        }
        .sheet(isPresented: $showSheet) {
            Text("Hello World")
        }
    }
}

To reproduce, run the above code and tap the Date picker at the top. Tapping the green button which has more space from the bottom does not pose the issue. Tapping the red button causes the bug.

Please do not Post SwiftUI questions here. SwiftUI is a closed-source library, so you must post about it on the apple developer forums. Furthermore, neither of your tags apply to this post. The "Development" tag does not apply because it is not about the development/implementation of the swift language itself. The "Core Libraries" tag does not apply either because SwiftUI is not a Swift core library.

@Peter-Schorn Thanks for your understanding regarding the mistake. I manage community forums as well and understand the confusion for new posters. I did apply a SwiftUI tag but couldn't find the right category so I selected the closest I thought would apply. I understand now SwiftUI is not meant for these forums.

Admins - please delete this post. Its been reposted on the Apple forums Sign In - Apple