v59.1.0
AppBar and FlexibleHeader shipped several new features in this release. 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.
}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.
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
- Add an inferTopSafeAreaInsetFromViewController behavior. (#4648) (featherless)
- Add new MDCAppBarNavigationController API. (#4650) (featherless)
- [FlexibleHeader] Add support for observing the tracking scroll view. (#4647) (featherless)
Ink
Changes
- [Catalog] Improve Ink demo color contrast (#4660) (Robert Moore)
- add commonMDCInkViewInit call to -initWithCoder: (#4662) (Andrew Overton)
Snackbar
Changes
- Create explicit singleton (#4556) (Robert Moore)
- Revert "Create explicit singleton (#4556)" (Jeff Verkoeyen)
Cards
Changes
- accessibility example for collection cards (#4488) (Galia Kaufman)
- Accessibility: Fixing documentation typos (#4634) (Galia Kaufman)
LibraryInfo
Changes
- Version bump. (Jeff Verkoeyen)
Dialogs
Changes
- Best example description (#4643) (ianegordon)
- Revert "Update buttons touch area to be 48x48 minimum (#4624)" (#4675) (ianegordon)
- Update buttons touch area to be 48x48 minimum (#4624) (Cody Weaver)
BottomNavigation
Changes
- Explicitly update label visibility after titleVisibility is set (#4635) (Andrew Overton)
- Fix delayed ink ripple (#4625) (Robert Moore)
- Give UITabBarItems' accessibilityIdentifiers to MDCBottomNavigationBa… (#4599) (Andrew Overton)