Something went wrong. Try again.
A small AI buddy that lives in the bottom right-hand corner of your Mac that wakes when you press a keybind.
Something went wrong. Try again.
123456789101112131415161718192021import AppKit
@MainActorfunc pickFile() async -> (URL, String)? { let panel = NSOpenPanel() panel.canChooseFiles = true panel.canChooseDirectories = false panel.allowsMultipleSelection = false panel.title = "Attach a file"
return await withCheckedContinuation { cont in panel.begin { response in guard response == .OK, let url = panel.url else { cont.resume(returning: nil) return } cont.resume(returning: (url, url.lastPathComponent)) } }}