v87.1.0
This minor release enhances support for Material Elevation in Text Fields and
Snackbar, brings new conveniences for resolving dynamic colors, and fixes a
dynamic color bug in MDCShapedShadowLayer.
New features
Text Fields
MDCTextField now supports Material Elevation. Clients can assign a value for
mdc_overrideBaseElevation or an elevationDidChangeBlock to ensure that
both the Text Field and any subviews can react to elevation changes.
Snackbar
MDCSnackbarManager now supports assigning a
traitCollectionDidChangeBlockForMessageView and an
mdc_elevationDidChangeBlockForMessageView. These blocks make it easier to
respond to changes in either the elevation or trait collections of the
MDCSnackbarMessageView.
Material Elevation
Material Elevation has a new UIColor category method to make it easier to
optimize checking for dynamic color changes.
Previously
UIColor *resolvedColor = originalColor;
#if defined(__IPHONE_13_0) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0)
if (@available(iOS 13.0, *)) {
if ([traitCollection
hasDifferentColorAppearanceComparedToTraitCollection:previousTraitCollection]) {
resolvedColor = [self mdc_resolvedColorWithTraitCollection:traitCollection elevation:elevation];
}
}
#endifThis Release
UIColor *resolvedColor =
[dynamicColor mdc_resolvedColorWithTraitCollection:currentTraitCollection
previousTraitCollection:previousTraitCollection
elevation:elevation];API changes
Elevation
UIColor(MaterialElevation)
new method: -mdc_resolvedColorWithTraitCollection:previousTraitCollection:elevation: in UIColor(MaterialElevation)
Snackbar
MDCSnackbarManager
new property: mdc_elevationDidChangeBlockForMessageView in MDCSnackbarManager
new property: traitCollectionDidChangeBlockForMessageView in MDCSnackbarManager
TextFields
MDCTextField
modified class: MDCTextField
| Type of change: | Swift declaration |
|---|---|
| From: | class MDCTextField : UITextField, MDCTextInput, MDCLeadingViewTextInput |
| To: | class MDCTextField : UITextField |
modified class: MDCTextField
| Type of change: | Declaration |
|---|---|
| From: | @interface MDCTextField : UITextField <MDCTextInput, MDCLeadingViewTextInput> |
| To: | @interface MDCTextField : UITextField |
Changes
Elevation
- Add a convenience method to resolve dynamic color only when traitCollection's color appearance has changed. (#8315) (Wenyu Zhang)
Shapes
- Update border color to support dynamic color (#8308) (Cody Weaver)
Snackbar
- Adding traitCollection and elevationDidChange blocks of the messageView in the manager. (#8330) (Yarden Eitan)
TextFields
- Add MaterialElevation support. (#8325) (Cody Weaver)