wenghengcong
2/25/2019 - 9:23 AM

NSPanel #panel #ui

NSPanel #panel #ui

 	// form https://www.raywenderlich.com/1047-advanced-collection-views-in-os-x-tutorial
    let openPanel = NSOpenPanel()
    openPanel.canChooseDirectories = false
    openPanel.canChooseFiles = true
    openPanel.allowsMultipleSelection = true;
    openPanel.allowedFileTypes = ["public.image"]
    openPanel.beginSheetModal(for: self.view.window!) { (response) -> Void in
      guard response.rawValue == NSFileHandlingPanelOKButton else {return}
      self.insertAtIndexPathFromURLs(urls: openPanel.urls, atIndexPath: insertAtIndexPath)
    }