Material Components v59.1.0 Release Notes

  • πŸš€ AppBar and FlexibleHeader shipped several new features in this release and Snackbar's manager is now implemented as a true singleton. This release also includes additional accessibility improvements and examples, and also fixes some bugs.

    πŸ†• New features

    The new MDCAppBarNavigationController class is a simpler integration strategy for adding an App Bar to an application. Example:

    let navigationController = MDCAppBarNavigationController()
    
    // Will automatically inject an AppBar into the view controller if one is not already present.
    navigationController.pushViewController(viewController, animated: true)
    

    πŸ‘ This new API enables all of the new AppBar and FlexibleHeader behaviors, meaning view controllers will better handle being presented in non-full screen settings. If you have already integrated with App Bar, migrating to MDCAppBarNavigationController will allow you to delete a substantial amount of boilerplate from your application. Most notably, MDCAppBarNavigationController enables the new observesTrackingScrollViewScrollEvents feature on FlexibleHeader, meaning you do not need to forward scroll view events to the navigation controller.

    At a minimum you will need to implement the MDCAppBarNavigationController's delegate to theme the injected App Bars. Implement the delegate like so:

    navigationController.delegate = self
    
    // MARK: MDCAppBarNavigationControllerInjectorDelegate
    
    func appBarNavigationController(_ navigationController: MDCAppBarNavigationController,
                                    willAdd appBar: MDCAppBar,
                                    asChildOf viewController: UIViewController) {
      let colorScheme: MDCSemanticColorScheme = <# Fetch your color scheme #>
      let typographyScheme: MDCTypographyScheme = <# Fetch your typography scheme #>
      MDCAppBarColorThemer.applySemanticColorScheme(colorScheme, to: appBar)
      MDCAppBarTypographyThemer.applyTypographyScheme(typographyScheme, to: appBar)
    
      // Additional configuration of appBar if needed.
    }
    

    0️⃣ AppBar's new inferTopSafeAreaInsetFromViewController property enables App Bars to be presented in non-full-screen contexts, such as iPad popovers or extensions. Consider enabling this property by default in all use cases.

    FlexibleHeader's new observesTrackingScrollViewScrollEvents property allows the FlexibleHeader to automatically observe content offset changes to the tracking scroll view, removing the need for forwarding the UIScrollViewDelegate events to the FlexibleHeader. Note: you can only use this new feature if you have not enabled the shift behavior.

    βœ… MDCSnackbarManager is now implemented as a true singleton with the ability to also create individual instances, making it possible to write self-contained tests for the component.

    API changes

    AppBar

    MDCAppBarNavigationController

    πŸ†• new class: MDCAppBarNavigationController

    πŸ†• new property: delegate in MDCAppBarNavigationController

    πŸ†• new method: -appBarForViewController: in MDCAppBarNavigationController

    MDCAppBarNavigationControllerDelegate

    πŸ†• new protocol: MDCAppBarNavigationControllerDelegate

    πŸ†• new method: -appBarNavigationController:willAddAppBar:asChildOfViewController: in MDCAppBarNavigationControllerDelegate

    MDCAppBar

    πŸ†• new property: inferTopSafeAreaInsetFromViewController in MDCAppBar

    FlexibleHeader

    MDCFlexibleHeaderView

    πŸ†• new property: observesTrackingScrollViewScrollEvents in MDCFlexibleHeaderView

    Component changes

    AppBar

    πŸ”„ Changes

    Ink

    πŸ”„ Changes

    Snackbar

    πŸ”„ Changes

    Cards

    πŸ”„ Changes

    LibraryInfo

    πŸ”„ Changes

    πŸ”Š Dialogs

    πŸ”„ Changes

    BottomNavigation

    πŸ”„ Changes

    FlexibleHeader

    πŸ”„ Changes