Skip to content

Instantly share code, notes, and snippets.

Created January 13, 2017 17:52
import Cocoa
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
@IBOutlet weak var window: NSWindow!
@IBOutlet var objectController: NSObjectController!
dynamic var foo: String = "" {
didSet { print("did set foo to \(self.foo)") }
}
@IBAction func saveOrSomething(_ sender: Any) {
self.objectController.commitEditing()
print("as this is clicked, foo is '\(self.foo)'")
// presumably, do something to save the data
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment