Material Components v80.0.0 Release Notes

  • ๐Ÿš€ This major release introduces Dynamic Type support for Typography Schemes as well as โœ… UIFontMetrics-like support for Dynamic Type for Material Typography. It also includes snapshot tests for additional components and less-restrictive badging for Tabs.

    ๐Ÿ’ฅ Breaking changes

    MDCTypographyScheming has a new non-optional API, mdc_adjustsFontForContentSizeCategory that is YES if the returned fonts should use the new Dynamic Type APIs available from Material Typography. Existing implementations may wish to migrate (at least initially) by returning NO as a read-only ๐Ÿ‘ value until support can be added.

    - (void)mdc_adjustsFontForContentSizeCategory {
      return NO;
    }
    
    public var mdc_adjustsFontForContentSizeCategory: Bool {
      return false;
    }
    

    ๐Ÿ†• New features

    ๐Ÿ‘Œ Improved Dynamic Type Support

    โšก๏ธ The Typography and TypographyScheme components have been updated for improved Dynamic Type support. ๐Ÿ‘ Most clients will make use of this support through MDCTypographyScheme, though it is possible to create scalable fonts manually via MDCFontScaler within Typography. The new scaling curves have โšก๏ธ been updated for last year's refresh of Material Design typography and font values.

    Objective-C

    // Typography Scheme is the most typical way to receive scalable fonts.
    MDCTypographyScheme *typographyScheme = [[MDCTypographyScheme alloc] initWithDefaults:MDCTypographySchemeDefaultsMaterial201902];
    UIFont *scaledBody1Font = [typographyScheme.body1 mdc_scaledFontForCurrentSizeCategory];
    
    // If Typography Schemes aren't used, it's possible to create the fonts manually.
    // Initial set-up to apply scaling curves to a base UIFont.
    UIFont *baseFont = [UIFont systemFontOfSize:18.0];
    MDCFontScaler *body2Scaler = [[MDCFontScaler alloc] initForMaterialTextStyle:MDCTextStyleBody2];
    UIFont *scalableFont = [body2Scaler scaledFontWithFont:baseFont];
    
    // Now UIFonts appropriate for Dynamic Type size categories can be created anywhere.
    UIFont *baseFontScaledToDefault = [scalableFont mdc_scaledFontAtDefaultSize];
    UIFont *baseFontScaledForExtraLarge = [scalableFont mdc_scaledFontForSizeCategory:UIContentSizeCategoryExtraLarge];
    UIFont *baseFontScaledForCurrentSizeCategory = [scalableFont mdc_scaledFontForCurrentSizeCategory];
    
    

    Swift

    // Typography Scheme is the most typical way to receive scalable fonts.
    let typographyScheme = MDCTypographyScheme(defaults: .material201902)
    let scaledBody1Font = typographyScheme.body1.mdc_scaledFontForCurrentSizeCategory()
    
    // If Typography Schemes aren't used, it's possible to create the fonts manually.
    // Initial set-up to apply scaling curves to a base UIFont.
    let baseFont = UIFont.systemFont(ofSize: 18)
    let body2Scaler = MDCFontScaler(forMaterialTextStyle: .body2)
    let scalableFont = body2Scaler.scaledFont(with: baseFont)
    
    // Now UIFonts appropriate for Dynamic Type size categories can be created anywhere.
    let baseFontScaledToDefault = scalableFont.mdc_scaledFontAtDefaultSize()
    let baseFontScaledForExtraLarge = scalableFont.mdc_scaledFont(forSizeCategory: .extraLarge)
    let baseFontScaledForCurrentSizeCategory = scalableFont.mdc_scaledFontForCurrentSizeCategory()
    

    API changes

    Typography

    ๐Ÿ’… MDCTextStyleButton

    ๐Ÿ†• new constant: MDCTextStyleButton

    ๐Ÿ’… MDCTextStyleCaption

    ๐Ÿ†• new constant: MDCTextStyleCaption

    ๐Ÿ’… MDCTextStyleSubtitle2

    ๐Ÿ†• new constant: MDCTextStyleSubtitle2

    ๐Ÿ’… MDCTextStyleSubtitle1

    ๐Ÿ†• new constant: MDCTextStyleSubtitle1

    ๐Ÿ’… MDCTextStyleBody1

    ๐Ÿ†• new constant: MDCTextStyleBody1

    UIFont(MaterialScalable)

    ๐Ÿ†• new method: -mdc_scaledFontForCurrentSizeCategory in UIFont(MaterialScalable)

    ๐Ÿ†• new method: -mdc_scaledFontAtDefaultSize in UIFont(MaterialScalable)

    ๐Ÿ†• new method: -mdc_scaledFontForSizeCategory: in UIFont(MaterialScalable)

    ๐Ÿ†• new category: UIFont(MaterialScalable)

    ๐Ÿ†• new property: mdc_scalingCurve in UIFont(MaterialScalable)

    MDCFontScaler

    ๐Ÿ†• new class method: +scalerForMaterialTextStyle: in MDCFontScaler

    ๐Ÿ†• new method: -scaledValueForValue: in MDCFontScaler

    ๐Ÿ†• new class: MDCFontScaler

    ๐Ÿ†• new method: -init in MDCFontScaler

    ๐Ÿ†• new method: -initForMaterialTextStyle: in MDCFontScaler

    ๐Ÿ†• new method: -scaledFontWithFont: in MDCFontScaler

    ๐Ÿ’… MDCTextStyleHeadline4

    ๐Ÿ†• new constant: MDCTextStyleHeadline4

    ๐Ÿ’… MDCTextStyleHeadline3

    ๐Ÿ†• new constant: MDCTextStyleHeadline3

    ๐Ÿ’… MDCTextStyleHeadline2

    ๐Ÿ†• new constant: MDCTextStyleHeadline2

    ๐Ÿ’… MDCTextStyleHeadline6

    ๐Ÿ†• new constant: MDCTextStyleHeadline6

    ๐Ÿ’… MDCTextStyleBody2

    ๐Ÿ†• new constant: MDCTextStyleBody2

    ๐Ÿ’… MDCTextStyle

    ๐Ÿ†• new typedef: MDCTextStyle

    ๐Ÿ’… MDCTextStyleOverline

    ๐Ÿ†• new constant: MDCTextStyleOverline

    ๐Ÿ’… MDCTextStyleHeadline1

    ๐Ÿ†• new constant: MDCTextStyleHeadline1

    ๐Ÿ’… MDCTextStyleHeadline5

    ๐Ÿ†• new constant: MDCTextStyleHeadline5

    TypographyScheme

    0๏ธโƒฃ MDCTypographySchemeDefaults

    ๐Ÿ†• new enum value: MDCTypographySchemeDefaultsMaterial201902 in MDCTypographySchemeDefaults

    MDCTypographyScheme

    ๐Ÿ†• new property: mdc_adjustsFontForContentSizeCategory in MDCTypographyScheme

    MDCTypographyScheming

    ๐Ÿ†• new property: mdc_adjustsFontForContentSizeCategory in MDCTypographyScheming

    Component changes

    ๐Ÿ”„ Changes

    ActivityIndicator

    AppBar

    Buttons

    HeaderStackView

    Ripple

    ShapeLibrary

    Shapes

    Tabs

    Typography

    schemes/Typography