Formatter is an abstract class that declares an interface for an object that creates, converts, or validates a human-readable form of 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.