From 1637db218095be0fb31a5d5d355509cf2e82e250 Mon Sep 17 00:00:00 2001 From: NachoSoto Date: Thu, 15 Jun 2023 08:10:35 -0700 Subject: [PATCH] `debugRevenueCatOverlay`: ability to close on `macOS`/`Catalyst` (#2649) ![Screenshot 2023-06-14 at 11 53 37](https://github.com/RevenueCat/purchases-ios/assets/685609/206242bc-4887-495b-a894-2bda064bd8a3) --- Sources/Support/DebugUI/DebugContentViews.swift | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Sources/Support/DebugUI/DebugContentViews.swift b/Sources/Support/DebugUI/DebugContentViews.swift index d2f41f4fb7..7942abc5fc 100644 --- a/Sources/Support/DebugUI/DebugContentViews.swift +++ b/Sources/Support/DebugUI/DebugContentViews.swift @@ -22,6 +22,9 @@ struct DebugSwiftUIRootView: View { @StateObject private var model = DebugViewModel() + @Environment(\.presentationMode) + private var presentationMode + var body: some View { NavigationStack(path: self.$model.navigationPath) { DebugSummaryView(model: self.model) @@ -39,6 +42,17 @@ struct DebugSwiftUIRootView: View { .foregroundStyle(Material.thinMaterial) .edgesIgnoringSafeArea(.all) ) + #if os(macOS) || targetEnvironment(macCatalyst) + .toolbar { + ToolbarItem(placement: .automatic) { + Button { + self.presentationMode.wrappedValue.dismiss() + } label: { + Label("Close", systemImage: "xmark") + } + } + } + #endif } .task { await self.model.load()