Ok, after messing with that code for my previous comment (trying to get it under the(ridiculous 500 character limit) -- I found that adding a .navigationTitle to the main view stops the crashing. Is it required to have a navigation title set if using a toolbar?
Meta side note: Why is code formatting on the official Apple Dev forum so poor? Isn't it about time to add better handing of multi-line code snippets?
Post
Replies
Boosts
Views
Activity
I'm getttng the exact same crash reports (only crashes Previews, not sim/real device). Please share your fix, I'm begging you! :)
Simple View that recreates crash:
@State private var isPresentingSheet = false
NavigationView {
Text("Main View")
.toolbar {
ToolbarItem(placement: .navigationBarTrailing) {
Button("Present Sheet") { self.isPresentingSheet = true }
}
}
.sheet(isPresented: $isPresentingSheet) {
Color.blue
}
}
}
Swift 5, Xcode 14.2
Thanks for updating us! Really appreciate that.
Thanks for the update! Makes me feel a bit better..