April 2015
Intermediate to advanced
556 pages
17h 47m
English
Your goal here is to have the configuration settings that the user specifies in the sheet be reflected in the die view. To do that, DieView needs to expose properties which can be configured.
Open DieView.swift. First, add the properties which users of the class can configure:
var highlightForDragging: Bool = false {
didSet {
needsDisplay = true
}
}
var color: NSColor = NSColor.whiteColor() {
didSet {
needsDisplay = true
}
}
var numberOfTimesToRoll: Int = 10
var mouseDownEvent: NSEvent?
Now MainWindowController can set the color and numberOfTimesToRoll on each DieView. But setting these properties does not do anything yet.
Besides giving color a default value, there are two other uses
of NSColor.whiteColor() ...
Read now
Unlock full access