diff --git a/macOS/Navigation/ActivePostToolbarView.swift b/macOS/Navigation/ActivePostToolbarView.swift index 991fb2c..417db66 100644 --- a/macOS/Navigation/ActivePostToolbarView.swift +++ b/macOS/Navigation/ActivePostToolbarView.swift @@ -17,7 +17,10 @@ struct ActivePostToolbarView: View { ) .disabled(activePost.status == PostStatus.local.rawValue) .popover(isPresented: $isPresentingSharingServicePicker) { - PostEditorSharingPicker(sharingItems: createPostUrl()) + PostEditorSharingPicker( + isPresented: $isPresentingSharingServicePicker, + sharingItems: createPostUrl() + ) } Button(action: { publishPost(activePost) }, label: { Image(systemName: "paperplane") }) .disabled(activePost.body.isEmpty || activePost.status == PostStatus.published.rawValue) diff --git a/macOS/PostEditor/PostEditorSharingPicker.swift b/macOS/PostEditor/PostEditorSharingPicker.swift index 97d2c99..02f7c96 100644 --- a/macOS/PostEditor/PostEditorSharingPicker.swift +++ b/macOS/PostEditor/PostEditorSharingPicker.swift @@ -1,6 +1,7 @@ import SwiftUI struct PostEditorSharingPicker: NSViewRepresentable { + @Binding var isPresented: Bool var sharingItems: [Any] = [] func makeNSView(context: Context) -> some NSView { @@ -32,6 +33,7 @@ struct PostEditorSharingPicker: NSViewRepresentable { didChoose service: NSSharingService? ) { sharingServicePicker.delegate = nil + self.owner.isPresented = false } } }