Material Components v81.0.0 Release Notes

  • ๐Ÿš€ This major release introduces the Ripple component and integrates it with Cards. There are also ๐Ÿ‘ visual changes for badges on Tabs, multi-line title support for Bottom Navigation, and improved ๐Ÿ‘ Dynamic Type support for Buttons and Feature Highlight.

    ๐Ÿ’ฅ Breaking changes

    The appearance of badges on MDCTabBar has changed. Badges now appear similar to those on 0๏ธโƒฃ MDCBottomNavigationBar and are, by default, a red "pill" shape with white text. The color can be customized by assigning a value to - UITabBarItem.badgeColor.

    ๐Ÿ†• New features

    Ripple integration with Cards

    โœ… Cards now support the latest iteration of the Material Design "ripple" effect. Clients can test this functionality by setting enableRippleBehavior to YES.

    Swift

    myCard.enableRippleBehavior = true
    

    Objective-C

    self.myCard.enableRippleBehavior = YES;
    

    ๐Ÿ‘ Multi-line title support in Bottom Navigation

    ๐Ÿ‘ Clients can enable multi-line title support in MDCBottomNavigationBar by setting titlesNumberOfLines to a value other than 1. This API should be used only as a last resort, when it is not possible to provide shorter titles that fit within the available screen space.

    Swift

    bottomNavigationBar.titlesNumberOfLines = 0
    

    Objective-C

    self.bottomNavigationBar.titlesNumberOfLines = 0;
    

    Automatic Dynamic Type font adjustment in Feature Highlight and Buttons

    ๐Ÿ‘ Buttons and Feature Highlight now support enabling automatic font size adjustment for Dynamic Type when the fonts used by the components have scaling curves attached using MDCFontScaler. Both components use the new scaling if mdc_adjustsFontForContentSizeCategory is set to YES.

    Swift

    // The new TypographyScheme defaults provide scaled fonts
    containerScheme.typographyScheme = MDCTypographyScheme.init(defaults: .material201902)
    let button = MDCButton()
    button.applyContainedTheme(withScheme: containerScheme)
    button.setTitle("Submit", for: UIControlState())
    // Enable automatic font adjustment
    button.mdc_adjustsFontForContentSizeCategory = true
    

    Objective-C

    // The new TypographyScheme defaults provide scaled fonts
    self.containerScheme.typographyScheme =
        [[MDCTypographyScheme alloc] initWithDefaults: MDCTypographySchemeDefaultsMaterial201804];
    MDCButton *button = [[MDCButton alloc] init];
    [button applyContainedThemeWithScheme:self.containerScheme];
    [button setTitle:@"Submit" forState:UIControlStateNormal];
    // Enable automatic font adjustment
    button.mdc_adjustsFontForContentSizeCategory = YES;
    

    API changes

    Banner

    MDCBannerView

    ๐Ÿ†• new property: textLabel in MDCBannerView

    ๐Ÿ†• new property: imageView in MDCBannerView

    ๐Ÿ†• new property: leadingButton in MDCBannerView

    ๐Ÿ†• new property: trailingButton in MDCBannerView

    โœ‚ removed property: buttons in MDCBannerView

    โœ‚ removed property: text in MDCBannerView

    โœ‚ removed property: image in MDCBannerView

    โœ‚ removed property: numberOfButtons in MDCBannerView

    modified class: MDCBannerView

    Type of change: Declaration
    From: @interface MDCBannerView : UIView @property(nonatomic, copy, nonnull) NSString *text; @property(nonatomic, strong, nullable) UIImage *image; // default is nil @property(nonatomic, assign) NSUInteger numberOfButtons; // default is 1 /** The buttons representing the banner's actions. */ @property(nonatomic, readonly, copy, nonnull) NSArray<MDCButton *> *buttons; @end
    ๐Ÿ”ง To:

    BottomNavigation

    MDCBottomNavigationBar

    ๐Ÿ†• new property: titlesNumberOfLines in MDCBottomNavigationBar

    Buttons

    MDCButton

    ๐Ÿ†• new property: mdc_legacyFontScaling in MDCButton

    Cards

    MDCCardCollectionCell

    ๐Ÿ†• new property: rippleView in MDCCardCollectionCell

    ๐Ÿ†• new property: dragged in MDCCardCollectionCell

    ๐Ÿ†• new property: enableRippleBehavior in MDCCardCollectionCell

    modified class: MDCCardCollectionCell

    Type of change: Declaration
    0๏ธโƒฃ From:
    0๏ธโƒฃ To:

    MDCCard

    ๐Ÿ†• new property: rippleView in MDCCard

    ๐Ÿ†• new property: enableRippleBehavior in MDCCard

    modified class: MDCCard

    Type of change: Declaration
    0๏ธโƒฃ From:
    0๏ธโƒฃ To:

    ๐Ÿ”‹ FeatureHighlight

    MDCFeatureHighlightView

    ๐Ÿ†• new property: mdc_legacyFontScaling in MDCFeatureHighlightView

    modified class: MDCFeatureHighlightView

    Type of change: Declaration
    ๐Ÿ’ป From:
    ๐Ÿ’ป To:

    MDCFeatureHighlightViewController

    ๐Ÿ†• new property: mdc_legacyFontScaling in MDCFeatureHighlightViewController

    Ripple

    MDCRippleTouchController

    ๐Ÿ†• new method: -addRippleToView: in MDCRippleTouchController

    modified method: -init in MDCRippleTouchController

    Type of change: key.always_unavailable
    From: 1
    To: 0

    MDCRippleTouchControllerDelegate

    ๐Ÿ†• new method: -rippleTouchController:insertRippleView:intoView: in MDCRippleTouchControllerDelegate

    Component changes

    ๐Ÿ”„ Changes

    AppBar

    BottomNavigation

    Buttons

    ๐Ÿ”‹ FeatureHighlight

    Ripple

    Tabs