TypographyLabel

open class TypographyLabel : UILabel

A text label that supports Typography. You can optionally set maximumPointSize or maximumScaleFactor to set a cap on Dynamic Type scaling.

  • The current typographical layout

    Declaration

    Swift

    public private(set) var layout: TypographyLayout! { get }
  • Typography to be used for this label’s text

    Declaration

    Swift

    public var typography: Typography { get set }
  • (Optional) maximum point size when scaling the font.

    Value should be greater than Typography.fontSize. nil means no maximum for scaling. Has no effect for fixed Typography.

    If you wish to set a specific maximum scale factor instead of a fixed maximum point size, set maximumScaleFactor instead. maximumScaleFactor will be used if both properties are non-nil.

    Declaration

    Swift

    public var maximumPointSize: CGFloat? { get set }
  • (Optional) maximum scale factor to use when scaling the font.

    Value should be greater than 1. nil means no maximum scale factor. Has no effect for fixed Typography.

    If you wish to set a specific maximum point size instead of a scale factor, set maximumPointSize instead. Takes precedence over maximumPointSize if both properties are non-nil.

    Declaration

    Swift

    public var maximumScaleFactor: CGFloat? { get set }
  • Initializes a label using the specified Typography

    Declaration

    Swift

    required public init(typography: Typography)

    Parameters

    typography

    the font information to use

  • Initializes a label using the default Typography Typography.systemLabel

    Declaration

    Swift

    required public init?(coder: NSCoder)
  • Call this if you’ve made a change that would require text to be re-styled. (Normally this is not necessary). Override this if you need to do something additional when preferred content size or legibility weight has changed

    Declaration

    Swift

    open func adjustFonts()
  • Override this if you have colors that will not automatically adjust to Light / Dark mode, etc. This can be the case for CGColor or non-template images (or backgroundImages).

    Declaration

    Swift

    open func adjustColors()
  • Override this if you have typography that might change at different breakpoints. You should check .window?.bounds.size for potential changes.

    Declaration

    Swift

    open func adjustBreakpoint()