diff --git a/components/Snackbar/README.md b/components/Snackbar/README.md index d19dd80d74d..88f9d38d4bf 100644 --- a/components/Snackbar/README.md +++ b/components/Snackbar/README.md @@ -54,7 +54,6 @@ contain a text action, but no icons. - [Typical use: display a message with an action](#typical-use-display-a-message-with-an-action) - [Extensions](#extensions) - [Color Theming](#color-theming) - - [Typography Theming](#typography-theming) - - - @@ -183,42 +182,3 @@ message.action = action; There is currently no theing extension for MDCSnackbar. - - -### Typography Theming - -You can theme an snackbar with your app's typography scheme using the TypographyThemer extension. - -You must first add the Typography Themer extension to your project: - -```bash -pod 'MaterialComponents/Snackbar+TypographyThemer' -``` - - -#### Swift -```swift -// Step 1: Import the TypographyThemer extension -import MaterialComponents.MaterialSnackbar_TypographyThemer - -// Step 2: Create or get a typography scheme -let typographyScheme = MDCTypographyScheme() - -// Step 3: Apply the typography scheme to your component -MDCSnackbarTypographyThemer.applyTypographyScheme(typographyScheme) -``` - -#### Objective-C - -```objc -// Step 1: Import the TypographyThemer extension -#import "MaterialSnackbar+TypographyThemer.h" - -// Step 2: Create or get a typography scheme -id typographyScheme = [[MDCTypographyScheme alloc] init]; - -// Step 3: Apply the typography scheme to your component -[MDCSnackbarTypographyThemer applyTypographyScheme:colorScheme]; -``` - - diff --git a/components/Snackbar/docs/README.md b/components/Snackbar/docs/README.md index c44cbe172bc..305921a093f 100644 --- a/components/Snackbar/docs/README.md +++ b/components/Snackbar/docs/README.md @@ -53,4 +53,3 @@ visible to the user. ## Extensions - [Color Theming](color-theming.md) -- [Typography Theming](typography-theming.md) diff --git a/components/Snackbar/docs/typography-theming.md b/components/Snackbar/docs/typography-theming.md deleted file mode 100644 index af381a1b721..00000000000 --- a/components/Snackbar/docs/typography-theming.md +++ /dev/null @@ -1,36 +0,0 @@ -### Typography Theming - -You can theme an snackbar with your app's typography scheme using the TypographyThemer extension. - -You must first add the Typography Themer extension to your project: - -```bash -pod 'MaterialComponents/Snackbar+TypographyThemer' -``` - - -#### Swift -```swift -// Step 1: Import the TypographyThemer extension -import MaterialComponents.MaterialSnackbar_TypographyThemer - -// Step 2: Create or get a typography scheme -let typographyScheme = MDCTypographyScheme() - -// Step 3: Apply the typography scheme to your component -MDCSnackbarTypographyThemer.applyTypographyScheme(typographyScheme) -``` - -#### Objective-C - -```objc -// Step 1: Import the TypographyThemer extension -#import "MaterialSnackbar+TypographyThemer.h" - -// Step 2: Create or get a typography scheme -id typographyScheme = [[MDCTypographyScheme alloc] init]; - -// Step 3: Apply the typography scheme to your component -[MDCSnackbarTypographyThemer applyTypographyScheme:colorScheme]; -``` - diff --git a/components/Snackbar/examples/supplemental/SnackbarExampleSupplemental.m b/components/Snackbar/examples/supplemental/SnackbarExampleSupplemental.m index fd8daa04780..6d26b7f78ab 100644 --- a/components/Snackbar/examples/supplemental/SnackbarExampleSupplemental.m +++ b/components/Snackbar/examples/supplemental/SnackbarExampleSupplemental.m @@ -13,7 +13,6 @@ // limitations under the License. #import "SnackbarExampleSupplemental.h" -#import "MaterialSnackbar+TypographyThemer.h" static NSString *const kCellIdentifier = @"Cell"; @@ -24,7 +23,6 @@ - (void)setupExampleViews:(NSArray *)choices { self.view.backgroundColor = [UIColor whiteColor]; [self.collectionView registerClass:[MDCCollectionViewTextCell class] forCellWithReuseIdentifier:kCellIdentifier]; - [MDCSnackbarTypographyThemer applyTypographyScheme:self.typographyScheme]; } #pragma mark - UICollectionView diff --git a/components/Snackbar/src/TypographyThemer/MDCSnackbarTypographyThemer.h b/components/Snackbar/src/TypographyThemer/MDCSnackbarTypographyThemer.h deleted file mode 100644 index 5b2b2da758d..00000000000 --- a/components/Snackbar/src/TypographyThemer/MDCSnackbarTypographyThemer.h +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2018-present the Material Components for iOS authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#import "MaterialSnackbar.h" -#import "MaterialTypographyScheme.h" - -/** - The Material Design typography system's themer for all snackbar messages. - - @warning This API will eventually be deprecated. See the individual method documentation for - details on replacement APIs. - Learn more at docs/theming.md#migration-guide-themers-to-theming-extensions - */ -@interface MDCSnackbarTypographyThemer : NSObject -@end - -@interface MDCSnackbarTypographyThemer (Deprecated) - -/** - Applies a typography scheme's properties to all snackbar messages. - - @param typographyScheme The typography scheme to apply to all snackbar messages. - - @warning This API will eventually be deprecated. There is no replacement yet. - Track progress here: https://github.com/material-components/material-components-ios/issues/7172 - Learn more at docs/theming.md#migration-guide-themers-to-theming-extensions - */ -+ (void)applyTypographyScheme:(nonnull id)typographyScheme; - -@end diff --git a/components/Snackbar/src/TypographyThemer/MDCSnackbarTypographyThemer.m b/components/Snackbar/src/TypographyThemer/MDCSnackbarTypographyThemer.m deleted file mode 100644 index 28af0da1565..00000000000 --- a/components/Snackbar/src/TypographyThemer/MDCSnackbarTypographyThemer.m +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2018-present the Material Components for iOS authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#import "MDCSnackbarTypographyThemer.h" - -@implementation MDCSnackbarTypographyThemer - -+ (void)applyTypographyScheme:(nonnull id)typographyScheme { - MDCSnackbarManager.buttonFont = typographyScheme.button; - MDCSnackbarManager.messageFont = typographyScheme.body2; -} - -@end diff --git a/components/Snackbar/src/TypographyThemer/MaterialSnackbar+TypographyThemer.h b/components/Snackbar/src/TypographyThemer/MaterialSnackbar+TypographyThemer.h deleted file mode 100644 index 084d717079f..00000000000 --- a/components/Snackbar/src/TypographyThemer/MaterialSnackbar+TypographyThemer.h +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2018-present the Material Components for iOS authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#import "MDCSnackbarTypographyThemer.h" diff --git a/components/Snackbar/tests/unit/MDCSnackbarTypographyThemerTests.swift b/components/Snackbar/tests/unit/MDCSnackbarTypographyThemerTests.swift deleted file mode 100644 index dfb53a1ad98..00000000000 --- a/components/Snackbar/tests/unit/MDCSnackbarTypographyThemerTests.swift +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2018-present the Material Components for iOS authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -import XCTest -import MaterialComponents.MaterialSnackbar -import MaterialComponents.MaterialSnackbar_TypographyThemer - -class MDCSnackbarTypographyThemerTests: XCTestCase { - - override func tearDown() { - MDCSnackbarManager.dismissAndCallCompletionBlocks(withCategory: nil) - - super.tearDown() - } - - func testSnackbarTypographyThemer() { - // Given - let typographyScheme = MDCTypographyScheme() - let message = MDCSnackbarMessage() - message.text = "How much wood would a woodchuck chuck if a woodchuck could chuck wood?" - typographyScheme.button = UIFont.boldSystemFont(ofSize: 12) - typographyScheme.body2 = UIFont.systemFont(ofSize: 19) - MDCSnackbarManager.buttonFont = UIFont.systemFont(ofSize: 21) - MDCSnackbarManager.messageFont = UIFont.systemFont(ofSize: 30) - - // When - MDCSnackbarTypographyThemer.applyTypographyScheme(typographyScheme) - - MDCSnackbarManager.show(message) - - // Then - XCTAssertEqual(MDCSnackbarManager.buttonFont, typographyScheme.button) - XCTAssertEqual(MDCSnackbarManager.messageFont, typographyScheme.body2) - } - -}