April 2015
Intermediate to advanced
556 pages
17h 47m
English
In Dice, add a method to ConfigurationWindowController:
presentAsSheetOnWindow(_:completionHandler:).
The method’s parameter should be the window the configuration sheet should be
displayed on, and the completion handler will be a closure of type
(DieConfiguration?)->(Void).
If the user clicks OK, the DieConfiguration
will be passed to the completion handler; otherwise it will be nil
to signal that nothing changed.
Here is how your method will look when it is called:
windowController.presentAsSheetOnWindow(window, completionHandler: {
configuration in
if let configuration = configuration {
dieView.color = configuration.color
dieView.numberOfTimesToRoll = configuration.rolls
}
})
Read now
Unlock full access