Slide 17
Slide 17 text
Import Cocoa
Class ViewController: NSViewController {
func copy() {
let panel = NSOpenPanel()
panel.canChooseFiles = true
panel.canChooseDirectories = false
panel.allowsMultipleSelection = false
panel.allowedFileTypes = NSImage.imageTypes
panel.begin(completionHandler: { num -> Void in
if num == NSApplication.ModalResponse.OK,
let path = panel.url?.path {
Self.read(url: path)
}
})
}
}