SwiftUI Popover Crash on iPad During Resizing in Stage Manager with Exception.
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Trying to layout popover in the delegate callback popoverPresentationController:willRepositionPopoverToRect:inView: will lead to recursion. Do not force the popover's container view or an ancestor to layout in this callback.'
(Occurred from iPadOS 18.1)
struct ContentView: View {
@State var showPopover: Bool = false
var body: some View {
VStack {
Text("Hello, world!")
Button(action: {
showPopover = true
}, label: {
Text("Open Popover")
})
}
.padding()
.popover(isPresented: $showPopover, attachmentAnchor: .point(.trailing), content: {
VStack {
Text("Popover Content")
}
})
}
}