NSFormatter is an abstract class that declares an interface for objects that create, interpret, and validate the textual representation of values. The Foundation framework provides several concrete subclasses of
- iOS 8.0+
- macOS 10.10+
- tvOS 9.0+
- watchOS 2.0+
NSFormatter is intended for subclassing. A custom formatter can restrict the input and enhance the display of data in novel ways. For example, you could have a custom formatter that ensures that serial numbers entered by a user conform to predefined formats. Before you decide to create a custom formatter, make sure that you cannot configure the public subclasses to satisfy your requirements.
For instructions on how to create your own custom formatter, see Creating a Custom Formatter.