I think I found a bug in SwiftUI on macOS 15.4 that crashes apps

We've been receiving crash reports for our app from users that have upgraded to macOS 15.4.

I have upgraded my developer machine and immediately was able to reproduce the crash.

I was able to create a minimal reproducible scenario. The following view crashes the app when sheet is presented with this trace:

The window has been marked as needing another Update Constraints in Window pass, but it has already had more Update Constraints in Window passes than there are views in the window.
<_TtC7SwiftUIP33_7B5508BFB2B0CAF1E28E206F2014E66B23SheetPresentationWindow: 0x1111074c0> 0x9bd (2493) {{0, 0}, {100, 108}} en
(
0 CoreFoundation 0x000000018bdfddf0 __exceptionPreprocess + 176
1 libobjc.A.dylib 0x000000018b8c2b60 objc_exception_throw + 88
2 CoreFoundation 0x000000018bdfdce0 +[NSException exceptionWithName:reason:userInfo:] + 0
3 AppKit 0x000000019043d394 -[NSWindow(NSDisplayCycle) _postWindowNeedsUpdateConstraints] + 1788
4 AppKit 0x000000018f9f8c08 -[NSView _informContainerThatSubviewsNeedUpdateConstraints] + 64
5 AppKit 0x000000018f9f8b8c -[NSView setNeedsUpdateConstraints:] + 468
6 SwiftUI 0x00000001bc0e5110 $s7SwiftUI13NSHostingViewC14setNeedsUpdate33_32B6F54841135BB466A5C1362EB89D05LLyyF + 80
7 SwiftUI 0x00000001bc101f28 $s7SwiftUI13NSHostingViewC13requestUpdate5afterySd_tF + 616

Conditions that are important:

  • accessing a publishable property inside the sheet
  • .sheet() on a component that is wrapped in another (VStack is required in the example provided)
  • being used inside NavigationSplitView
  • Presents of @Environment(\.openURL. Doesn't have to be used, simply present on the view.
struct ContentView: View {
@Environment(\.openURL) private var open
@State var who = "world"
@State var shown = false
var body: some View {
NavigationSplitView(sidebar: {
Text("Hello, world")
}, detail: {
VStack(spacing: 20) {
Button("Kill me pls") {
shown = true
}
.frame(width: 110, height: 110)
.sheet(isPresented: $shown) {
VStack {
HStack() {
Text("Hello, \(who)!")
}
}
.presentationBackground(.thinMaterial)
}
}
})
}
}

You should probably raise this as a bug in the usual way. It won't really get progressed if it's only posted in these Developer Forums.

You need to raise each issue you find separately at https://feedbackassistant.apple.com/ You can post the FB numbers here if you want, so that others can link to them.

Thanks for flagging this.

As a work around, wrap the view inside a seperate struct for example:

struct ContentView: View {
@State private var shown = false
var body: some View {
NavigationSplitView {
Text("Hello, world")
} detail: {
VStack(spacing: 20) {
Button("Kill me pls") {
shown = true
}
.frame(width: 110, height: 110)
.sheet(isPresented: $shown) {
SheetView()
.presentationBackground(.thinMaterial)
}
}
}
}
}
struct SheetView: View {
@State private var who = "world"
var body: some View {
VStack {
HStack() {
Text("Hello, \(who)!")
}
}
}
}
I think I found a bug in SwiftUI on macOS 15.4 that crashes apps
 
 
Q