UIFont objects provide a mechanism to describe a font with a dictionary of attributes. This font descriptor can be used later to create or modify a
UIFont object. Font descriptors can be archived and unarchived. Font descriptors have a font matching capability, so that you can partially describe a font by creating a font descriptor with, for example, just a family name. You can then find all the available fonts on the system with a matching family name using
- iOS 7.0+
- tvOS 7.0+
- watchOS 2.0+
There are several ways to create a new
UIFont object. To take advantage of text styles and respect the user’s current content size category, use
preferred. You can also use
init(name: to create a font descriptor based on either your custom attributes dictionary or on a specific font’s name and size. Alternatively you can use one of the
font instance methods (such as
with) to create a modified version of an existing descriptor (the receiver). The latter methods are useful if you have an existing descriptor and simply want to change one aspect.
All attributes in the attributes dictionary are optional.