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

10 Formatters and Validation

Users are complicated. They have strong opinions about how they want to input and see data. As a developer, you want to support their whims, to get that I thought it might do this and it does! reaction. With formatters your text fields can present and accept data textually without cluttering your controller. Formatters also provide validation at the controller layer, while Key-Value Validation allows you to validate at the model layer.

Formatters

Formatters convert strings into data and data into strings. In the same way that an array controller is a lens for an array, changing the model of your application into a representation for the view layer, a formatter is a lens for one piece of data ...

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