O'Reilly logo

Mastering Swift 3 - Linux by Jon Hoffman

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

Formatter

Formatter is an abstract class that declares an interface for an object that creates, converts or validates a human-readable form of some data. The types that subclass the Formatter class are generally used when we want to take a particular object, such as an instance of the Date class, and present the value in a form that the user of our application can understand.

Apple has provided several concrete implementations of the Formatter class and in this section we will look at two of them. It is important to remember that the formatters that Apple provides will provide the proper format for the default locale of the device the application is running on.

We will start off by looking at the DateFormatter type.

DateFormatter

The DateFormatter ...

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