April 2015
Intermediate to advanced
556 pages
17h 47m
English
In an application, you will often want to draw things differently on screen than on the printer. For example, in a drawing program, the on-screen view might show a grid on-screen but not when printed on paper.
In your drawRect(_:) method, you can ask the current graphics context if it is currently drawing to the screen:
if NSGraphicsContext.currentContextDrawingToScreen() {
// ... draw the grid ...
}