Issue #405
Enable Read/Write
for User Selected File
under Sandbox
to avoid bridge absent error
func showSave(
name: String,
window: NSWindow
) async -> URL? {
let panel = NSSavePanel()
panel.directoryURL = FileManager.default.homeDirectoryForCurrentUser
panel.nameFieldStringValue = name
let response = await panel.beginSheetModal(for: window)
if response == .OK {
return panel.url
} else {
return nil
}
}
To save multiple files, use NSOpenPanel
let panel = NSOpenPanel()
panel.canChooseFiles = false
panel.allowsMultipleSelection = false
panel.canChooseDirectories = true
panel.directoryURL = FileManager.default.homeDirectoryForCurrentUser