Jan 4 2017
Basic Image Transformation
(OSX 10.11, Xcode 8) Create a new app: drop an NSImageView and two buttons into the storyboard, set up an outlet for the image view and two actions – zoomIn and zoomOut for the buttons. 0) Not recommended: scaleUnitSquare @IBAction func zoomOut(_ sender: AnyObject) { imageView.scaleUnitSquare(to: NSSize(width: 0.4, height: 0.4)) } This works perfectly fine. […]
Jan 5 2017
Application Design: Enums (with bonus tuple)
In the zoom example app, to make life easier for me, I went for a cyclical zoom: 2x magnification, 3x magnification, 1x magnification. When Apple first announced Swift, I liked many things about it, but the thing that made me swoon was enums. Swift enums are wonderful tools to shape your application flow. Here, we […]
By Extelligent Cocoa • Application Design, Coding Meta • • Tags: enums, responsibilities, tuples, zoom