UIFont

extension UIFont
  • Error registering or unregistering a font

    See more

    Declaration

    Swift

    public enum RegisterError : Error
  • Registers a font file with the system Font Manager.

    Throws

    an error if the file cannot be registered (including if it is already registered).

    Declaration

    Swift

    public static func register(
        name: String,
        fileExtension ext: String? = nil,
        subpath: String? = nil,
        bundle: Bundle
    ) throws

    Parameters

    name

    font file name (may also include subpath or extension)

    ext

    (optional) font file extension (e.g. “otf” or “ttf”) if not already included in name

    subpath

    (optional) subpath to the font file within the bundle if not already included in name

    bundle

    bundle containing the font file

  • Unregisters a font file with the system Font Manager.

    Should be paired with succcessful call to register(:)

    Throws

    an error if the file cannot be unregistered (including if it was never registered or has already been successfully unregistered).

    Declaration

    Swift

    public static func unregister(
        name: String,
        fileExtension ext: String? = nil,
        subpath: String? = nil,
        bundle: Bundle
    ) throws

    Parameters

    name

    font file name (may also include subpath or extension)

    ext

    (optional) font file extension (e.g. “otf” or “ttf”) if not already included in name

    subpath

    (optional) subpath to the font file within the bundle if not already included in name

    bundle

    bundle containing the font file