I have a problem with a MacCatalyst app I build and run on MacOS 14.6 with XCode 16.4. In this app if I click a button to show a .sheet(item
a few times (typically between 3 and 8 times) then the app starts consuming 100% CPU and the Spinning Wait Cursor shows. Minimum reproducible example is below. I would appreciate any suggestions on how to address this. Thank you!
import SwiftUI
enum Panel: Hashable {
case panel
}
@main
struct TestSheetsApp: App {
var body: some Scene {
WindowGroup {
NavigationSplitView {
List() {
NavigationLink(value: Panel.panel) {
Label("Panel", systemImage: "ladybug.fill")
}
}
} detail: {
NavigationStack() {
ContentView()
}
}
}
}
}
struct ContentView: View {
@State var popupItem : PopupItem?
var body: some View {
NavigationStack {
Button("Show Popup") {
popupItem = PopupItem()
}
.sheet(item: $popupItem) { popupItem in
Popup()
}
}
}
}
struct PopupItem: Identifiable {
let id = UUID()
}
struct Popup: View {
@Environment(.dismiss) var dismiss
var body: some View {
NavigationStack {
Button("Dismiss") {
dismiss()
}
}
}
}