Returns a font matching the given font descriptor.


init(descriptor: UIFontDescriptor, size pointSize: CGFloat)



The font descriptor to match.


The size in points to which the font is scaled. If greater than 0.0, it has precedence over UIFontDescriptorSizeAttribute in descriptor.

Return Value

A font object for the specified descriptor and size.


In most cases, you can simply use init(name:size:) to create standard scaled fonts.

See Also

Creating Fonts

class func preferredFont(forTextStyle: UIFont.TextStyle) -> UIFont

Returns an instance of the system font for the specified text style and scaled appropriately for the user's selected content size category.

class func preferredFont(forTextStyle: UIFont.TextStyle, compatibleWith: UITraitCollection?) -> UIFont

Returns an instance of the system font for the appropriate text style and traits.

Scaling Fonts Automatically

Scale text in your interface automatically by using Dynamic Type.

Creating Self-Sizing Table View Cells

Create table view cells that support Dynamic Type and use system spacing constraints to adjust the spacing surrounding text labels.

init?(name: String, size: CGFloat)

Creates and returns a font object for the specified font name and size.

func withSize(CGFloat) -> UIFont

Returns a font object that is the same as the receiver but which has the specified size instead.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software