April 2015
Intermediate to advanced
556 pages
17h 47m
English
Your app is coming along nicely, but your users will complain, “Why do I have to double-click to start editing after an insert? It is obvious that I am going to immediately change the name of the new person. Can’t you start the editing as part of the insert?”
Oddly, this is a little tricky to do. Open Document.swift. First, add two new outlets:
class Document: NSDocument {
@IBOutlet weak var tableView: NSTableView!
@IBOutlet weak var arrayController: NSArrayController!
var employees: [Employee] = [] {
Next, while still in Document.swift, add a stub for a new action, addEmployee(_:), to the implementation:
// MARK: - Actions
@IBAction func addEmployee(sender: NSButton) {
}
You will write the implementation ...
Read now
Unlock full access