Skip to content

Commit 372d6b2

Browse files
author
Robert Moore
authored
No longer using -init for Color Scheme. (material-components#5734)
{MDC iOS} No longer using `-init` for Color Scheme. Based on the discussions in go/mdc-ios-theming, we should not use the `-init` default initializer. Instead, we should use an explicit set of defaults. Search regex: '\[\[MDCSemanticColorScheme alloc\] init\]'
1 parent d90bf4c commit 372d6b2

File tree

110 files changed

+220
-129
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+220
-129
lines changed

components/ActionSheet/examples/ActionSheetTypicalUse.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ - (instancetype)init {
3333
self = [super init];
3434
if (self) {
3535
self.title = @"Action Sheet";
36-
_colorScheme = [[MDCSemanticColorScheme alloc] init];
36+
_colorScheme =
37+
[[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
3738
_typographyScheme = [[MDCTypographyScheme alloc] init];
3839
_showButton = [[MDCButton alloc] init];
3940
_buttonScheme = [[MDCButtonScheme alloc] init];

components/ActionSheet/src/ActionSheetThemer/MDCActionSheetScheme.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ @implementation MDCActionSheetScheme
1919
- (instancetype)init {
2020
self = [super init];
2121
if (self) {
22-
_colorScheme = [[MDCSemanticColorScheme alloc] init];
22+
_colorScheme =
23+
[[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
2324
_typographyScheme = [[MDCTypographyScheme alloc] init];
2425
}
2526
return self;

components/ActionSheet/tests/unit/MDCActionSheetThemeTest.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ - (void)setUp {
4848
[super setUp];
4949

5050
self.actionSheet = [[MDCActionSheetController alloc] init];
51-
self.colorScheme = [[MDCSemanticColorScheme alloc] init];
51+
self.colorScheme =
52+
[[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
5253
UIColor *surface = UIColor.blueColor;
5354
UIColor *onSurface = UIColor.redColor;
5455
self.colorScheme.surfaceColor = surface;
@@ -74,7 +75,8 @@ - (void)testDefaultScheme {
7475
// Given
7576
MDCActionSheetScheme *defaultScheme = [[MDCActionSheetScheme alloc] init];
7677
MDCTypographyScheme *defaultTypographyScheme = [[MDCTypographyScheme alloc] init];
77-
MDCSemanticColorScheme *defaultColorScheme = [[MDCSemanticColorScheme alloc] init];
78+
MDCSemanticColorScheme *defaultColorScheme =
79+
[[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
7880

7981
// Then
8082
XCTAssertEqualObjects(defaultScheme.typographyScheme.subtitle1,

components/ActivityIndicator/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ MDCActivityIndicatorColorThemer.applySemanticColorScheme(colorScheme, to: activi
242242
#import "MaterialActivityIndicator+ColorThemer.h"
243243

244244
// Step 2: Create or get a color scheme
245-
id<MDCColorScheming> colorScheme = [[MDCSemanticColorScheme alloc] init];
245+
id<MDCColorScheming> colorScheme = [[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
246246

247247
// Step 3: Apply the color scheme to your component
248248
[MDCActivityIndicatorColorThemer applySemanticColorScheme:colorScheme

components/ActivityIndicator/docs/color-theming.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ MDCActivityIndicatorColorThemer.applySemanticColorScheme(colorScheme, to: activi
3030
#import "MaterialActivityIndicator+ColorThemer.h"
3131

3232
// Step 2: Create or get a color scheme
33-
id<MDCColorScheming> colorScheme = [[MDCSemanticColorScheme alloc] init];
33+
id<MDCColorScheming> colorScheme = [[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
3434

3535
// Step 3: Apply the color scheme to your component
3636
[MDCActivityIndicatorColorThemer applySemanticColorScheme:colorScheme

components/ActivityIndicator/examples/ActivityIndicatorExample.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ - (id)init {
3333
self = [super init];
3434
if (self) {
3535
self.title = @"Activity Indicator";
36-
self.colorScheme = [[MDCSemanticColorScheme alloc] init];
36+
self.colorScheme =
37+
[[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
3738
}
3839
return self;
3940
}

components/ActivityIndicator/examples/ActivityIndicatorTransitionExample.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ - (id)init {
4242
self = [super init];
4343
if (self) {
4444
self.title = @"Activity Indicator Transition";
45-
self.colorScheme = [[MDCSemanticColorScheme alloc] init];
45+
self.colorScheme =
46+
[[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
4647
self.typographyScheme = [[MDCTypographyScheme alloc] init];
4748
}
4849
return self;

components/AppBar/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ MDCAppBarColorThemer.applySemanticColorScheme(colorScheme, to: component)
668668
#import "MaterialAppBar+ColorThemer.h"
669669

670670
// Step 2: Create or get a color scheme
671-
id<MDCColorScheming> colorScheme = [[MDCSemanticColorScheme alloc] init];
671+
id<MDCColorScheming> colorScheme = [[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
672672

673673
// Step 3: Apply the color scheme to your component
674674
[MDCAppBarColorThemer applySemanticColorScheme:colorScheme

components/AppBar/docs/color-theming.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ MDCAppBarColorThemer.applySemanticColorScheme(colorScheme, to: component)
2828
#import "MaterialAppBar+ColorThemer.h"
2929

3030
// Step 2: Create or get a color scheme
31-
id<MDCColorScheming> colorScheme = [[MDCSemanticColorScheme alloc] init];
31+
id<MDCColorScheming> colorScheme = [[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
3232

3333
// Step 3: Apply the color scheme to your component
3434
[MDCAppBarColorThemer applySemanticColorScheme:colorScheme

components/AppBar/examples/AppBarImageryExample.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ - (void)dealloc {
3232
- (id)init {
3333
self = [super init];
3434
if (self) {
35-
_colorScheme = [[MDCSemanticColorScheme alloc] init];
35+
_colorScheme =
36+
[[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
3637

3738
_appBarViewController = [[MDCAppBarViewController alloc] init];
3839

components/AppBar/examples/AppBarInterfaceBuilderExampleController.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ - (void)commonAppBarInterfaceBuilderExampleSetup {
5757
self.appBarViewController.inferTopSafeAreaInsetFromViewController = YES;
5858
self.appBarViewController.headerView.minMaxHeightIncludesSafeArea = NO;
5959

60-
self.colorScheme = [[MDCSemanticColorScheme alloc] init];
60+
self.colorScheme =
61+
[[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
6162
[self addChildViewController:self.appBarViewController];
6263
}
6364

components/AppBar/examples/AppBarModalPresentationExample.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ - (instancetype)init {
4848
// Set preferred content size
4949
self.preferredContentSize = CGSizeMake(250, 500);
5050

51-
self.colorScheme = [[MDCSemanticColorScheme alloc] init];
51+
self.colorScheme =
52+
[[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
5253
}
5354
return self;
5455
}

components/AppBar/examples/AppBarPresentedExample.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ - (id)init {
5050

5151
[self addChildViewController:_appBarViewController];
5252

53-
self.colorScheme = [[MDCSemanticColorScheme alloc] init];
53+
self.colorScheme =
54+
[[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
5455
self.typographyScheme = [[MDCTypographyScheme alloc] init];
5556
}
5657
return self;

components/AppBar/examples/AppBarSectionHeadersExample.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ - (id)init {
4646

4747
[self addChildViewController:_appBarViewController];
4848

49-
self.colorScheme = [[MDCSemanticColorScheme alloc] init];
49+
self.colorScheme =
50+
[[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
5051
}
5152
return self;
5253
}

components/AppBar/examples/AppBarTypicalCollectionViewExample.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ - (id)init {
5353
[self addChildViewController:_appBarViewController];
5454
_appBarViewController.headerView.observesTrackingScrollViewScrollEvents = YES;
5555

56-
self.colorScheme = [[MDCSemanticColorScheme alloc] init];
56+
self.colorScheme =
57+
[[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
5758
self.typographyScheme = [[MDCTypographyScheme alloc] init];
5859
}
5960
return self;

components/AppBar/examples/AppBarTypicalUseExample.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ - (id)init {
5151
_appBarViewController.navigationBar.inkColor = [UIColor colorWithWhite:(CGFloat)0.9
5252
alpha:(CGFloat)0.1];
5353

54-
self.colorScheme = [[MDCSemanticColorScheme alloc] init];
54+
self.colorScheme =
55+
[[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
5556
self.typographyScheme = [[MDCTypographyScheme alloc] init];
5657
}
5758
return self;

components/AppBar/examples/AppBarWKWebViewLargeContentExample.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ - (id)init {
5656

5757
_appBar.navigationBar.inkColor = [UIColor colorWithWhite:(CGFloat)0.9 alpha:(CGFloat)0.1];
5858

59-
self.colorScheme = [[MDCSemanticColorScheme alloc] init];
59+
self.colorScheme =
60+
[[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
6061
self.typographyScheme = [[MDCTypographyScheme alloc] init];
6162
}
6263
return self;

components/AppBar/examples/AppBarWKWebViewLargeContentNoBugExample.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ - (id)init {
5555

5656
_appBar.navigationBar.inkColor = [UIColor colorWithWhite:(CGFloat)0.9 alpha:(CGFloat)0.1];
5757

58-
self.colorScheme = [[MDCSemanticColorScheme alloc] init];
58+
self.colorScheme =
59+
[[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
5960
self.typographyScheme = [[MDCTypographyScheme alloc] init];
6061
}
6162
return self;

components/AppBar/examples/AppBarWKWebViewSmallContentBugExample.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ - (id)init {
5757

5858
_appBar.navigationBar.inkColor = [UIColor colorWithWhite:(CGFloat)0.9 alpha:(CGFloat)0.1];
5959

60-
self.colorScheme = [[MDCSemanticColorScheme alloc] init];
60+
self.colorScheme =
61+
[[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
6162
self.typographyScheme = [[MDCTypographyScheme alloc] init];
6263
}
6364
return self;

components/AppBar/examples/AppBarWKWebViewSmallContentExample.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ - (id)init {
5555

5656
_appBar.navigationBar.inkColor = [UIColor colorWithWhite:(CGFloat)0.9 alpha:(CGFloat)0.1];
5757

58-
self.colorScheme = [[MDCSemanticColorScheme alloc] init];
58+
self.colorScheme =
59+
[[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
5960
self.typographyScheme = [[MDCTypographyScheme alloc] init];
6061
}
6162
return self;

components/AppBar/examples/AppBarWrappingUITableViewControllerExample.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ - (void)dealloc {
3737
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
3838
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
3939
if (self) {
40-
_colorScheme = [[MDCSemanticColorScheme alloc] init];
40+
_colorScheme =
41+
[[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
4142
_typographyScheme = [[MDCTypographyScheme alloc] init];
4243
}
4344
return self;

components/BottomAppBar/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ MDCBottomAppBarColorThemer.applySurfaceVariant(withSemanticColorScheme: colorSch
156156
#import "MaterialButtons+ButtonThemer.h"
157157

158158
// Step 2: Create or get a color scheme and typography scheme
159-
id<MDCColorScheming> colorScheme = [[MDCSemanticColorScheme alloc] init];
159+
id<MDCColorScheming> colorScheme = [[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
160160
id<MDCTypographyScheming> typographyScheme = [[MDCTypographyScheme alloc] init];
161161
MDCButtonScheme *buttonScheme = [[MDCButtonScheme alloc] init];
162162
buttonScheme.colorScheme = colorScheme;

components/BottomAppBar/docs/color-theming.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ MDCBottomAppBarColorThemer.applySurfaceVariant(withSemanticColorScheme: colorSch
4343
#import "MaterialButtons+ButtonThemer.h"
4444

4545
// Step 2: Create or get a color scheme and typography scheme
46-
id<MDCColorScheming> colorScheme = [[MDCSemanticColorScheme alloc] init];
46+
id<MDCColorScheming> colorScheme = [[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
4747
id<MDCTypographyScheming> typographyScheme = [[MDCTypographyScheme alloc] init];
4848
MDCButtonScheme *buttonScheme = [[MDCButtonScheme alloc] init];
4949
buttonScheme.colorScheme = colorScheme;

components/BottomAppBar/examples/BottomAppBarTypicalUseExample.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ - (id)init {
2626
self = [super init];
2727
if (self) {
2828
self.title = @"Bottom App Bar";
29-
_colorScheme = [[MDCSemanticColorScheme alloc] init];
29+
_colorScheme =
30+
[[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
3031
_typographyScheme = [[MDCTypographyScheme alloc] init];
3132
}
3233
return self;

components/BottomAppBar/tests/unit/BottomAppBarColorThemerTests.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ - (void)testPrimaryColorAppliedToBarTintColor {
4848

4949
- (void)testSurfaceVariantColorThemer {
5050
// Given
51-
MDCSemanticColorScheme *colorScheme = [[MDCSemanticColorScheme alloc] init];
51+
MDCSemanticColorScheme *colorScheme =
52+
[[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
5253
colorScheme.primaryColor = UIColor.orangeColor;
5354
colorScheme.onPrimaryColor = UIColor.cyanColor;
5455
colorScheme.surfaceColor = UIColor.blueColor;

components/BottomNavigation/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ MDCBottomNavigationBarColorThemer.applySemanticColorScheme(colorScheme, to: comp
136136
#import "MaterialBottomNavigation+ColorThemer.h"
137137

138138
// Step 2: Create or get a color scheme
139-
id<MDCColorScheming> colorScheme = [[MDCSemanticColorScheme alloc] init];
139+
id<MDCColorScheming> colorScheme = [[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
140140

141141
// Step 3: Apply the color scheme to your component
142142
[MDCBottomNavigationBarColorThemer applySemanticColorScheme:colorScheme

components/BottomNavigation/docs/color-theming.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ MDCBottomNavigationBarColorThemer.applySemanticColorScheme(colorScheme, to: comp
2828
#import "MaterialBottomNavigation+ColorThemer.h"
2929

3030
// Step 2: Create or get a color scheme
31-
id<MDCColorScheming> colorScheme = [[MDCSemanticColorScheme alloc] init];
31+
id<MDCColorScheming> colorScheme = [[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
3232

3333
// Step 3: Apply the color scheme to your component
3434
[MDCBottomNavigationBarColorThemer applySemanticColorScheme:colorScheme

components/BottomNavigation/examples/BottomNavigationTypicalUseExample.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ - (id)init {
3333
self = [super init];
3434
if (self) {
3535
self.title = @"Bottom Navigation";
36-
_colorScheme = [[MDCSemanticColorScheme alloc] init];
36+
_colorScheme =
37+
[[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
3738
_typographyScheme = [[MDCTypographyScheme alloc] init];
3839
}
3940
return self;

components/BottomNavigation/tests/unit/BottomNavigationBarColorThemerTests.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ @implementation BottomNavigationBarColorThemerTests
3636

3737
- (void)testColorScheming {
3838
// Given
39-
MDCSemanticColorScheme *colorScheme = [[MDCSemanticColorScheme alloc] init];
39+
MDCSemanticColorScheme *colorScheme =
40+
[[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
4041
colorScheme.primaryColor = [UIColor redColor];
4142
colorScheme.onPrimaryColor = [UIColor blueColor];
4243
UITabBarItem *item = [[UITabBarItem alloc] init];

components/BottomSheet/examples/supplemental/BottomSheetPresenterViewController.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ @implementation BottomSheetPresenterViewController {
2323
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
2424
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
2525
if (self) {
26-
_colorScheme = [[MDCSemanticColorScheme alloc] init];
26+
_colorScheme =
27+
[[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
2728
_typographyScheme = [[MDCTypographyScheme alloc] init];
2829
}
2930
return self;

components/ButtonBar/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ MDCButtonBarColorThemer.applySemanticColorScheme(colorScheme, to:buttonBar)
207207
#import "MaterialButtonBar+ColorThemer.h"
208208

209209
// Step 2: Create or get a color scheme
210-
id<MDCColorScheming> colorScheme = [[MDCSemanticColorScheme alloc] init];
210+
id<MDCColorScheming> colorScheme = [[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
211211

212212
// Step 3: Apply the color scheme to your component
213213
[MDCButtonBarColorThemer applySemanticColorScheme:colorScheme

components/ButtonBar/docs/color-theming.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ MDCButtonBarColorThemer.applySemanticColorScheme(colorScheme, to:buttonBar)
2828
#import "MaterialButtonBar+ColorThemer.h"
2929

3030
// Step 2: Create or get a color scheme
31-
id<MDCColorScheming> colorScheme = [[MDCSemanticColorScheme alloc] init];
31+
id<MDCColorScheming> colorScheme = [[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
3232

3333
// Step 3: Apply the color scheme to your component
3434
[MDCButtonBarColorThemer applySemanticColorScheme:colorScheme

components/ButtonBar/examples/ButtonBarCustomizedFontExample.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ @implementation ButtonBarCustomizedFontExample
2828
- (id)init {
2929
self = [super init];
3030
if (self) {
31-
self.colorScheme = [[MDCSemanticColorScheme alloc] init];
31+
self.colorScheme =
32+
[[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
3233
self.typographyScheme = [[MDCTypographyScheme alloc] init];
3334

3435
self.title = @"Button Bar";

components/ButtonBar/examples/ButtonBarTypicalUseExample.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ @implementation ButtonBarTypicalUseExample
2727
- (id)init {
2828
self = [super init];
2929
if (self) {
30-
self.colorScheme = [[MDCSemanticColorScheme alloc] init];
30+
self.colorScheme =
31+
[[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
3132
self.title = @"Button Bar";
3233
}
3334
return self;

components/Buttons/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ MDCTextButtonColorThemer.applySemanticColorScheme(colorScheme, to: component)
373373
#import "MaterialButtons+ColorThemer.h"
374374

375375
// Step 2: Create or get a color scheme
376-
id<MDCColorScheming> colorScheme = [[MDCSemanticColorScheme alloc] init];
376+
id<MDCColorScheming> colorScheme = [[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
377377

378378
// Step 3: Apply the color scheme to your component using the desired button style
379379
[MDCContainedButtonColorThemer applySemanticColorScheme:colorScheme

components/Buttons/docs/color-theming.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ MDCTextButtonColorThemer.applySemanticColorScheme(colorScheme, to: component)
3030
#import "MaterialButtons+ColorThemer.h"
3131

3232
// Step 2: Create or get a color scheme
33-
id<MDCColorScheming> colorScheme = [[MDCSemanticColorScheme alloc] init];
33+
id<MDCColorScheming> colorScheme = [[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
3434

3535
// Step 3: Apply the color scheme to your component using the desired button style
3636
[MDCContainedButtonColorThemer applySemanticColorScheme:colorScheme

components/Buttons/examples/ButtonsShapesExampleViewController.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ @implementation ButtonsShapesExampleViewController
3030
- (id)init {
3131
self = [super init];
3232
if (self) {
33-
self.colorScheme = [[MDCSemanticColorScheme alloc] init];
33+
self.colorScheme =
34+
[[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
3435
self.typographyScheme = [[MDCTypographyScheme alloc] init];
3536
}
3637
return self;

components/Buttons/examples/ButtonsTypicalUseExampleViewController.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ @implementation ButtonsTypicalUseExampleViewController
3232
- (id)init {
3333
self = [super init];
3434
if (self) {
35-
self.colorScheme = [[MDCSemanticColorScheme alloc] init];
35+
self.colorScheme =
36+
[[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
3637
self.shapeScheme = [[MDCShapeScheme alloc] init];
3738
self.typographyScheme = [[MDCTypographyScheme alloc] init];
3839
}

components/Buttons/examples/FloatingButtonExampleViewController.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ @implementation FloatingButtonExampleViewController
3535
- (id)init {
3636
self = [super init];
3737
if (self) {
38-
self.colorScheme = [[MDCSemanticColorScheme alloc] init];
38+
self.colorScheme =
39+
[[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
3940
self.shapeScheme = [[MDCShapeScheme alloc] init];
4041
}
4142
return self;

components/Buttons/src/ButtonThemer/MDCButtonScheme.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ @implementation MDCButtonScheme
1919
- (instancetype)init {
2020
self = [super init];
2121
if (self) {
22-
_colorScheme = [[MDCSemanticColorScheme alloc] init];
22+
_colorScheme =
23+
[[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
2324
_shapeScheme = [[MDCShapeScheme alloc] init];
2425
_typographyScheme = [[MDCTypographyScheme alloc] init];
2526
_minimumHeight = 36;

0 commit comments

Comments
 (0)