From 5bf5be6c25355b56e48faa98cb02a17ea7887af7 Mon Sep 17 00:00:00 2001 From: Max Goedjen Date: Sun, 23 Jul 2023 17:35:28 -0400 Subject: [PATCH] Fix popovers not showing on Sonoma beta (#477) * Use .rect(bounds) on Sonoma. * Comment --- Sources/Secretive/Views/ContentView.swift | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Sources/Secretive/Views/ContentView.swift b/Sources/Secretive/Views/ContentView.swift index 461db2d..defbf40 100644 --- a/Sources/Secretive/Views/ContentView.swift +++ b/Sources/Secretive/Views/ContentView.swift @@ -88,7 +88,7 @@ extension ContentView { .foregroundColor(.white) }) .buttonStyle(ToolbarButtonStyle(color: color)) - .popover(item: $selectedUpdate, attachmentAnchor: .point(.bottom), arrowEdge: .bottom) { update in + .popover(item: $selectedUpdate, attachmentAnchor: attachmentAnchor, arrowEdge: .bottom) { update in UpdateDetailView(update: update) } } @@ -147,7 +147,7 @@ extension ContentView { } }) .buttonStyle(ToolbarButtonStyle(lightColor: .black.opacity(0.05), darkColor: .white.opacity(0.05))) - .popover(isPresented: $showingAgentInfo, attachmentAnchor: .point(.bottom), arrowEdge: .bottom) { + .popover(isPresented: $showingAgentInfo, attachmentAnchor: attachmentAnchor, arrowEdge: .bottom) { VStack { Text("SecretAgent is Running") .font(.title) @@ -172,7 +172,7 @@ extension ContentView { .foregroundColor(.white) }) .buttonStyle(ToolbarButtonStyle(color: .orange)) - .popover(isPresented: $showingAppPathNotice, attachmentAnchor: .point(.bottom), arrowEdge: .bottom) { + .popover(isPresented: $showingAppPathNotice, attachmentAnchor: attachmentAnchor, arrowEdge: .bottom) { VStack { Image(systemName: "exclamationmark.triangle") .resizable() @@ -186,6 +186,11 @@ extension ContentView { } } + var attachmentAnchor: PopoverAttachmentAnchor { + // Ideally .point(.bottom), but broken on Sonoma (FB12726503) + .rect(.bounds) + } + } #if DEBUG