Skip to content

Instantly share code, notes, and snippets.

@mortenjust
Created December 1, 2015 22:54
Show Gist options
  • Save mortenjust/1faef7e499292d49c0b0 to your computer and use it in GitHub Desktop.
Save mortenjust/1faef7e499292d49c0b0 to your computer and use it in GitHub Desktop.
func selectFolder(){
let openPanel = NSOpenPanel();
openPanel.title = "Select a folder to watch for videos"
openPanel.message = "Videos you drop in the folder you select will be converted to animated gifs"
openPanel.showsResizeIndicator=true;
openPanel.canChooseDirectories = true;
openPanel.canChooseFiles = false;
openPanel.allowsMultipleSelection = false;
openPanel.canCreateDirectories = true;
openPanel.delegate = self;
openPanel.beginWithCompletionHandler { (result) -> Void in
if(result == NSFileHandlingPanelOKButton){
let path = openPanel.URL!.path!
// do something
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment