diff --git a/components/FeatureHighlight/src/MDCFeatureHighlightViewController.m b/components/FeatureHighlight/src/MDCFeatureHighlightViewController.m index a32c11ba2e7..2ddb2a781ac 100644 --- a/components/FeatureHighlight/src/MDCFeatureHighlightViewController.m +++ b/components/FeatureHighlight/src/MDCFeatureHighlightViewController.m @@ -65,10 +65,7 @@ - (void)viewDidLoad { UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; self.featureHighlightView.mdc_adjustsFontForContentSizeCategory = _mdc_adjustsFontForContentSizeCategory; - if (@available(iOS 10.0, *)) { - self.featureHighlightView.adjustsFontForContentSizeCategory = - _adjustsFontForContentSizeCategory; - } + self.featureHighlightView.adjustsFontForContentSizeCategory = _adjustsFontForContentSizeCategory; self.featureHighlightView.mdc_legacyFontScaling = _mdc_legacyFontScaling; __weak MDCFeatureHighlightViewController *weakSelf = self; diff --git a/components/List/examples/CollectionListCellExampleTypicalUse.m b/components/List/examples/CollectionListCellExampleTypicalUse.m index 0bfa4d88c19..10780f6c03a 100644 --- a/components/List/examples/CollectionListCellExampleTypicalUse.m +++ b/components/List/examples/CollectionListCellExampleTypicalUse.m @@ -21,8 +21,6 @@ static NSString *const kExampleDetailText = @"Pellentesque non quam ornare, porta urna sed, malesuada felis. Praesent at gravida felis, " "non facilisis enim. Proin dapibus laoreet lorem, in viverra leo dapibus a."; -static const CGFloat kSmallestCellHeight = 40; -static const CGFloat kSmallArbitraryCellWidth = 100; @implementation CollectionListCellExampleTypicalUse { NSMutableArray *_content; @@ -35,11 +33,7 @@ - (instancetype)init { flowLayout.minimumInteritemSpacing = 0; flowLayout.minimumLineSpacing = 1; flowLayout.scrollDirection = UICollectionViewScrollDirectionVertical; - if (@available(iOS 10.0, *)) { - flowLayout.estimatedItemSize = UICollectionViewFlowLayoutAutomaticSize; - } else { - flowLayout.estimatedItemSize = CGSizeMake(kSmallArbitraryCellWidth, kSmallestCellHeight); - } + flowLayout.estimatedItemSize = UICollectionViewFlowLayoutAutomaticSize; return [self initWithCollectionViewLayout:flowLayout]; } diff --git a/components/Tabs/src/private/MDCItemBarCell.m b/components/Tabs/src/private/MDCItemBarCell.m index b83c175fe2a..84dac0b8d46 100644 --- a/components/Tabs/src/private/MDCItemBarCell.m +++ b/components/Tabs/src/private/MDCItemBarCell.m @@ -228,11 +228,9 @@ - (void)updateWithItem:(UITabBarItem *)item self.selectedImage = item.selectedImage; self.image = item.image; self.badgeValue = item.badgeValue; - if (@available(iOS 10.0, *)) { - if (item.badgeColor) { - self.style.badgeColor = item.badgeColor; - self.badge.badgeColor = item.badgeColor; - } + if (item.badgeColor) { + self.style.badgeColor = item.badgeColor; + self.badge.badgeColor = item.badgeColor; } self.accessibilityIdentifier = item.accessibilityIdentifier; self.accessibilityLabel = item.accessibilityLabel; diff --git a/components/TextControls/examples/supplemental/MDCTextControlConfiguratorExample.m b/components/TextControls/examples/supplemental/MDCTextControlConfiguratorExample.m index 15ef6faf222..a0982fc13f3 100644 --- a/components/TextControls/examples/supplemental/MDCTextControlConfiguratorExample.m +++ b/components/TextControls/examples/supplemental/MDCTextControlConfiguratorExample.m @@ -131,23 +131,18 @@ - (void)decreaseContentSizeForChildViewController:(UIViewController *)childViewC - (void)setContentSizeCategory:(UIContentSizeCategory)contentSizeCategory onChildViewController:(UIViewController *)viewController { - if (@available(iOS 10.0, *)) { - UITraitCollection *contentSizeCategoryTraitCollection = - [UITraitCollection traitCollectionWithPreferredContentSizeCategory:contentSizeCategory]; - UITraitCollection *currentTraitCollection = viewController.traitCollection; - NSArray *traitCollections = @[ currentTraitCollection, contentSizeCategoryTraitCollection ]; - UITraitCollection *traitCollection = - [UITraitCollection traitCollectionWithTraitsFromCollections:traitCollections]; - [self setOverrideTraitCollection:traitCollection forChildViewController:viewController]; - [self.view setNeedsLayout]; - } + UITraitCollection *contentSizeCategoryTraitCollection = + [UITraitCollection traitCollectionWithPreferredContentSizeCategory:contentSizeCategory]; + UITraitCollection *currentTraitCollection = viewController.traitCollection; + NSArray *traitCollections = @[ currentTraitCollection, contentSizeCategoryTraitCollection ]; + UITraitCollection *traitCollection = + [UITraitCollection traitCollectionWithTraitsFromCollections:traitCollections]; + [self setOverrideTraitCollection:traitCollection forChildViewController:viewController]; + [self.view setNeedsLayout]; } - (UIContentSizeCategory)contentSizeCategoryForViewController:(UIViewController *)viewController { - if (@available(iOS 10.0, *)) { - return viewController.traitCollection.preferredContentSizeCategory; - } - return nil; + return viewController.traitCollection.preferredContentSizeCategory; } - (void)setContainerScheme:(id)containerScheme { diff --git a/components/TextControls/examples/supplemental/MDCTextControlContentViewController.m b/components/TextControls/examples/supplemental/MDCTextControlContentViewController.m index 628f8d11a17..3c70aa76bf9 100644 --- a/components/TextControls/examples/supplemental/MDCTextControlContentViewController.m +++ b/components/TextControls/examples/supplemental/MDCTextControlContentViewController.m @@ -144,10 +144,7 @@ - (MDCButton *)createContentSizeButtonWithTitle:(NSString *)title selector:(SEL) [button addTarget:self action:selector forControlEvents:UIControlEventTouchUpInside]; [button applyContainedThemeWithScheme:self.containerScheme]; [button sizeToFit]; - button.enabled = NO; - if (@available(iOS 10.0, *)) { - button.enabled = YES; - } + button.enabled = YES; return button; } diff --git a/components/TextControls/examples/supplemental/MDCTextControlTextAreaContentViewController.m b/components/TextControls/examples/supplemental/MDCTextControlTextAreaContentViewController.m index 72e1f7fc5e9..5c222b178e9 100644 --- a/components/TextControls/examples/supplemental/MDCTextControlTextAreaContentViewController.m +++ b/components/TextControls/examples/supplemental/MDCTextControlTextAreaContentViewController.m @@ -147,20 +147,18 @@ - (void)resizeScrollViewSubviews { - (void)enforcePreferredFonts { [super enforcePreferredFonts]; - if (@available(iOS 10.0, *)) { - [self.allTextAreas - enumerateObjectsUsingBlock:^(MDCBaseTextArea *textArea, NSUInteger idx, BOOL *stop) { - textArea.textView.adjustsFontForContentSizeCategory = YES; - textArea.textView.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody - compatibleWithTraitCollection:textArea.traitCollection]; - textArea.leadingAssistiveLabel.font = - [UIFont preferredFontForTextStyle:UIFontTextStyleCaption2 - compatibleWithTraitCollection:textArea.traitCollection]; - textArea.trailingAssistiveLabel.font = - [UIFont preferredFontForTextStyle:UIFontTextStyleCaption2 - compatibleWithTraitCollection:textArea.traitCollection]; - }]; - } + [self.allTextAreas + enumerateObjectsUsingBlock:^(MDCBaseTextArea *textArea, NSUInteger idx, BOOL *stop) { + textArea.textView.adjustsFontForContentSizeCategory = YES; + textArea.textView.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody + compatibleWithTraitCollection:textArea.traitCollection]; + textArea.leadingAssistiveLabel.font = + [UIFont preferredFontForTextStyle:UIFontTextStyleCaption2 + compatibleWithTraitCollection:textArea.traitCollection]; + textArea.trailingAssistiveLabel.font = + [UIFont preferredFontForTextStyle:UIFontTextStyleCaption2 + compatibleWithTraitCollection:textArea.traitCollection]; + }]; } - (void)handleResignFirstResponderTapped { diff --git a/components/TextControls/examples/supplemental/MDCTextControlTextFieldContentViewController.m b/components/TextControls/examples/supplemental/MDCTextControlTextFieldContentViewController.m index e366336f169..7d2ad6a6ad9 100644 --- a/components/TextControls/examples/supplemental/MDCTextControlTextFieldContentViewController.m +++ b/components/TextControls/examples/supplemental/MDCTextControlTextFieldContentViewController.m @@ -172,20 +172,18 @@ - (void)resizeScrollViewSubviews { - (void)enforcePreferredFonts { [super enforcePreferredFonts]; - if (@available(iOS 10.0, *)) { - [self.allTextFields - enumerateObjectsUsingBlock:^(MDCBaseTextField *textField, NSUInteger idx, BOOL *stop) { - textField.adjustsFontForContentSizeCategory = YES; - textField.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody - compatibleWithTraitCollection:textField.traitCollection]; - textField.leadingAssistiveLabel.font = - [UIFont preferredFontForTextStyle:UIFontTextStyleCaption2 - compatibleWithTraitCollection:textField.traitCollection]; - textField.trailingAssistiveLabel.font = - [UIFont preferredFontForTextStyle:UIFontTextStyleCaption2 - compatibleWithTraitCollection:textField.traitCollection]; - }]; - } + [self.allTextFields + enumerateObjectsUsingBlock:^(MDCBaseTextField *textField, NSUInteger idx, BOOL *stop) { + textField.adjustsFontForContentSizeCategory = YES; + textField.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody + compatibleWithTraitCollection:textField.traitCollection]; + textField.leadingAssistiveLabel.font = + [UIFont preferredFontForTextStyle:UIFontTextStyleCaption2 + compatibleWithTraitCollection:textField.traitCollection]; + textField.trailingAssistiveLabel.font = + [UIFont preferredFontForTextStyle:UIFontTextStyleCaption2 + compatibleWithTraitCollection:textField.traitCollection]; + }]; } - (void)handleResignFirstResponderTapped { diff --git a/components/TextControls/src/BaseTextAreas/MDCBaseTextArea.m b/components/TextControls/src/BaseTextAreas/MDCBaseTextArea.m index b9f3b933227..d7741596387 100644 --- a/components/TextControls/src/BaseTextAreas/MDCBaseTextArea.m +++ b/components/TextControls/src/BaseTextAreas/MDCBaseTextArea.m @@ -398,14 +398,10 @@ - (CGFloat)numberOfLinesOfVisibleText { #pragma mark Dynamic Type - (void)setAdjustsFontForContentSizeCategory:(BOOL)adjustsFontForContentSizeCategory { - if (@available(iOS 10.0, *)) { - _adjustsFontForContentSizeCategory = adjustsFontForContentSizeCategory; - self.textView.adjustsFontForContentSizeCategory = adjustsFontForContentSizeCategory; - self.leadingAssistiveLabel.adjustsFontForContentSizeCategory = - adjustsFontForContentSizeCategory; - self.trailingAssistiveLabel.adjustsFontForContentSizeCategory = - adjustsFontForContentSizeCategory; - } + _adjustsFontForContentSizeCategory = adjustsFontForContentSizeCategory; + self.textView.adjustsFontForContentSizeCategory = adjustsFontForContentSizeCategory; + self.leadingAssistiveLabel.adjustsFontForContentSizeCategory = adjustsFontForContentSizeCategory; + self.trailingAssistiveLabel.adjustsFontForContentSizeCategory = adjustsFontForContentSizeCategory; } #pragma mark MDCTextControlState