aboutsummaryrefslogtreecommitdiff
path: root/Map/Presentation/Commands/MapCommands.swift
diff options
context:
space:
mode:
Diffstat (limited to 'Map/Presentation/Commands/MapCommands.swift')
-rw-r--r--Map/Presentation/Commands/MapCommands.swift11
1 files changed, 8 insertions, 3 deletions
diff --git a/Map/Presentation/Commands/MapCommands.swift b/Map/Presentation/Commands/MapCommands.swift
index a298956..fe21f57 100644
--- a/Map/Presentation/Commands/MapCommands.swift
+++ b/Map/Presentation/Commands/MapCommands.swift
@@ -62,6 +62,9 @@ struct MapCommands: Commands {
Button("commands.file.export") {
if let selectedEvolution, let document {
if let image = document.exportAsImage(withEvolution: selectedEvolution) {
+
+ // Capture image data to avoid sendability issues with NSImage
+ guard let tiffData = image.tiffRepresentation else { return }
let filename = url?.deletingPathExtension().lastPathComponent ?? "Untitled"
@@ -154,9 +157,11 @@ struct MapCommands: Commands {
savePanel.accessoryView = accessoryController.view
savePanel.begin { result in
- if result == .OK, let url = savePanel.url {
- if let tiffRepresentation = image.tiffRepresentation {
- let bitmapImage = NSBitmapImageRep(data: tiffRepresentation)
+ if result == .OK {
+ let bitmapImage = NSBitmapImageRep(data: tiffData)
+
+ Task { @MainActor in
+ guard let url = savePanel.url else { return }
let selectedFormat = formats[accessoryController.formatPopup.indexOfSelectedItem]
// Generate data based on selected format