v84.4.0
In this minor release we have expanded our support for custom Dynamic Type scaling curves in Buttons, Chips, and List, as well as additional tests and bug fixes.
New deprecations
mdc_legacyFontScaling in MDCButton and MDCChipView has been deprecated.
Please use adjustsFontForContentSizeCategoryWhenScaledFontIsUnavailable instead.
New features
Buttons, Chips, and List, have expanded their support for Dynamic Type to allow custom scaling curves to be associated with fonts:
MDCButton *button = [[MDCButton alloc] init];
UIFont *customFont = [UIFont fontWithName:@"CustomFontName" size:18.0];
MDCFontScaler *fontScaler = [MDCFontScaler scalerForMaterialTextStyle:MDCTextStyleBody1];
UIFont *customScalableFont = [fontScaler scaledFontWithFont:customFont];
[button setTitleFont:customScalingFont forState:UIControlStateNormal];Buttons, Chips, Dialogs, and List, now have a new property
adjustsFontForContentSizeCategoryWhenScaledFontIsUnavailable that affects the fallback behavior for when a scaled font is not provided.
If set to YES the font size will adjust even if a scaled font has not been provided for a given UIFont property on this component. If set to NO, the font size will only be adjusted if a scaled font has been provided.
ButtonBar now allows clients to present overlay views that point to views in an MDCButtonBar:
let rect = buttonBar.rect(for: item, in: view)
// Present an overlay pointing at `rect`As part of the typography component, we added a new method to UIFont mdc_scaledFontForTraitEnvironment: that returns a font with the same family, weight and traits, but whose point size is based on the given trait environment's preferred content size category.
API changes
ButtonBar
MDCButtonBar
new method: -rectForItem:item:inCoordinateSpace in MDCButtonBar
Buttons
MDCButton
new property: adjustsFontForContentSizeCategoryWhenScaledFontIsUnavailable in MDCButton
deprecated property: mdc_legacyFontScaling in MDCButton
Chips
MDCChipView
new property: adjustsFontForContentSizeCategoryWhenScaledFontIsUnavailable in MDCChipView
deprecated property: mdc_legacyFontScaling in MDCChipView
Dialogs
MDCAlertController
new property: adjustsFontForContentSizeCategoryWhenScaledFontIsUnavailable in MDCAlertController
List
MDCSelfSizingStereoCell
new property: adjustsFontForContentSizeCategoryWhenScaledFontIsUnavailable in MDCSelfSizingStereoCell
Typography
UIFont+MaterialScalable
new method: mdc_scaledFontForTraitEnvironment:traitEnvironment in UIFont+MaterialScalable
schemes/Typography
MDCTypographyScheme
new property: useCurrentContentSizeCategoryWhenApplied in MDCTypographyScheming
new property: useCurrentContentSizeCategoryWhenApplied in MDCTypographyScheme
Component changes
Changes
ButtonBar
- Expose a rectForItem:inCoordinateSpace: API. (#7438) (featherless)
- Fix a typo in the docs for rectForItem:inCoordinateSpace:. (#7496) (featherless)
Buttons
- Add snapshot test for dynamic type (#7429) (Cody Weaver)
- Fix issue with legacy dynamic type (#7466) (Cody Weaver)
- Fix up test (#7461) (Cody Weaver)
- Refactor dynamic type support to use mdc_scaledFontForTraitEnvironment. (#7489) (featherless)
- Revert updating fonts after adjustsFontForContentSizeCategoryWhenScaledFontIsUnavailable has been updated (#7480) (Cody Weaver)
- Update dynamic type to match other components (#7425) (Cody Weaver)
- Update name for fallback behavior. (#7452) (Cody Weaver)
Chips
- Add fallback behavior for M2 Dynamic Type. (#7432) (Wenyu Zhang)
- Apply Dynamic Type flag to typography themer. (#7414) (Wenyu Zhang)
- Fix a flag naming in Chip theming extension and added a missing test for this flag. (#7482) (Wenyu Zhang)
- Refactor dynamic type behavior by using a convenience method. (#7494) (Wenyu Zhang)
- Use umbrella header (#7423) (Cody Weaver)
Dialogs
- Add flag for legacy behavior for dynamic type (#7446) (Cody Weaver)
- Flash scroll indicators if content is larger than the scroll view. (#7434) (Cody Weaver)
- Move the private property declaration to the header (#7433) (Cody Weaver)
List
- Add M2 Dynamic Type support for MDCSelfSizingStereoCell (#7440) (Wenyu Zhang)
- Add basic snapshot tests for MDCSelfSizingStereoCell. (#7439) (Wenyu Zhang)
- Fix copyright dates for Theming files. (#7430) (Robert Moore)
- Snapshot tests for upcoming Scalable Font behavior. (#7458) (Wenyu Zhang)
- Update snapshot golden images for dynamic type change. (#7486) (Wenyu Zhang)
- add Dynamic Type support on List Typography Themer. (#7491) (Wenyu Zhang)
NavigationDrawer
- Prevent crash when passing nil completion block for a nullable method parameter. (#7450) (Robbie Kirk)
Tabs
Typography
- Add mdc_scaledFontForTraitEnvironment. (#7471) (featherless)
- Copy-edit of UIFont+MaterialScalable.h (#7475) (featherless)
- Implement copy semantics on the UIFont's mdc_scalingCurve. (#7476) (featherless)
- Split Typography doc into separate md files. (#7435) (Wenyu Zhang)
- Update Dynamic Type section in Typography doc. (#7469) (Wenyu Zhang)
- add a brief doc for Dynamic Type support. (#7431) (Wenyu Zhang)
schemes/Typography
- Add a brief dynamic type doc for Typography scheme. (#7473) (Wenyu Zhang)
- Add useCurrentContentSizeCategoryWhenApplied. (#7465) (featherless)
- Align useCurrentContentSizeCategoryWhenApplied with internal behavior. (#7479) (featherless)
- make MDCTypographyScheme conform to NSObject. (#7485) (Wenyu Zhang)