Skip to content

Instantly share code, notes, and snippets.

@dilames
Created January 15, 2020 01:20
Show Gist options
  • Save dilames/9e4a5f46cf099cd918ac59ffe03f4c4b to your computer and use it in GitHub Desktop.
Save dilames/9e4a5f46cf099cd918ac59ffe03f4c4b to your computer and use it in GitHub Desktop.
class ViewController: NSViewController {
@IBOutlet private weak var textField: NSTextField!
@IBOutlet private weak var textView: NSTextView!
private var bashService = BashService()
@IBAction func execute(_ sender: Any) {
bashService.execute(textField.stringValue) { response in
DispatchQueue.main.async {
self.textView.string += "\(response) \n"
self.textField.stringValue = ""
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment