DispatchQueue.main.sync {
observableobj.content = text
}
</pre>
===ディレクトリを選択===
----
<pre>
static func chooseDir() -> String {
let dialog = NSOpenPanel();
dialog.title = "Choose a root directory"
dialog.showsResizeIndicator = true
dialog.showsHiddenFiles = false
dialog.allowsMultipleSelection = false
dialog.canChooseDirectories = true
dialog.canChooseFiles = false
if (dialog.runModal() == NSApplication.ModalResponse.OK) {
let result = dialog.url
if (result != nil) {
let path: String = result!.path
return path
}
}
return "";
}
</pre>