O'Reilly logo

Cocoa Programming for OS X: The Big Nerd Ranch Guide by Aaron Hillegass, Adam Preble, Nate Chandler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Configuring the Die Views

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:

 ​ ​ ​ ​v​a​r​ ​h​i​g​h​l​i​g​h​t​F​o​r​D​r​a​g​g​i​n​g​:​ ​B​o​o​l​ ​=​ ​f​a​l​s​e​ ​{​
 ​ ​ ​ ​ ​ ​ ​ ​d​i​d​S​e​t​ ​{​
 ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​n​e​e​d​s​D​i​s​p​l​a​y​ ​=​ ​t​r​u​e​
 ​ ​ ​ ​ ​ ​ ​ ​}​
 ​ ​ ​ ​}​

 ​ ​ ​ ​v​a​r​ ​c​o​l​o​r​:​ ​N​S​C​o​l​o​r​ ​=​ ​N​S​C​o​l​o​r​.​w​h​i​t​e​C​o​l​o​r​(​)​ ​{​
 ​ ​ ​ ​ ​ ​ ​ ​d​i​d​S​e​t​ ​{​
 ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​n​e​e​d​s​D​i​s​p​l​a​y​ ​=​ ​t​r​u​e​
 ​ ​ ​ ​ ​ ​ ​ ​}​
 ​ ​ ​ ​}​

 ​ ​ ​ ​

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required