I would like to create a window to save text files to disk, but I do not know how to create a File Explorer using Storyboard.
I would like to create a window to save text files to disk, but I do not know how to create a File Explorer using Storyboard.
I solved this problem with the following code:
var painelSalvar: NSSavePanel = NSSavePanel();
painelSalvar.prompt = "Salvar";
painelSalvar.worksWhenModal = true;
painelSalvar.title = "Salvar Programa";
painelSalvar.message = "";
painelSalvar.runModal();
var arquivo = painelSalvar.URL;
if (arquivo != nil){
let newString : String? = arquivo?.absoluteString!.stringByReplacingOccurrencesOfString("file://", withString: "", options: NSStringCompareOptions.LiteralSearch, range: nil);
return newString!;
}
return "";