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 ...

Get Cocoa Programming for OS X: The Big Nerd Ranch Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.