November 2016
Intermediate to advanced
480 pages
14h 42m
English
The template creates a few Swift files and a file called Main.storyboard, which you will get to in a moment. First, open ViewController.swift. Begin by removing the overridden functions the template provided for you, as you will not need them for this app.
Listing 26.1 Cleaning out template code (ViewController.swift)
import Cocoa
class ViewController: NSViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override var representedObject: Any? {
didSet {
// Update the view, if already loaded.
}
}
}
Note that the ViewController class is a subclass of NSViewController. As the name suggests, a view controller manages the user interface ...
Read now
Unlock full access