diff --git a/MaterialComponentsBeta.podspec b/MaterialComponentsBeta.podspec index 560db7f74d2..79e4e6d3ced 100644 --- a/MaterialComponentsBeta.podspec +++ b/MaterialComponentsBeta.podspec @@ -104,17 +104,18 @@ Pod::Spec.new do |mdc| end end - mdc.subspec "Tabs2" do |component| - component.ios.deployment_target = '9.0' - component.public_header_files = "components/#{component.base_name}/src/*.h" - component.source_files = [ - "components/#{component.base_name}/src/*.{h,m}", - "components/#{component.base_name}/src/private/*.{h,m}", + mdc.subspec "Tabs+TabBarView" do |extension| + extension.ios.deployment_target = '9.0' + extension.public_header_files = "components/#{extension.base_name.split('+')[0]}/src/#{extension.base_name.split('+')[1]}/*.h" + extension.source_files = [ + "components/#{extension.base_name.split('+')[0]}/src/#{extension.base_name.split('+')[1]}/*.{h,m}", + "components/#{extension.base_name.split('+')[0]}/src/#{extension.base_name.split('+')[1]}/private/*.{h,m}" ] + extension.dependency "MaterialComponents/#{extension.base_name.split('+')[0]}" - component.test_spec 'UnitTests' do |unit_tests| + extension.test_spec 'UnitTests' do |unit_tests| unit_tests.source_files = [ - "components/#{component.base_name}/tests/unit/*.m" + "components/#{extension.base_name.split('+')[0]}/tests/unit/#{extension.base_name.split('+')[1]}/*.{h,m,swift}", ] end end diff --git a/MaterialComponentsSnapshotTests.podspec b/MaterialComponentsSnapshotTests.podspec index 137157ac0c8..7a06e3a2f09 100644 --- a/MaterialComponentsSnapshotTests.podspec +++ b/MaterialComponentsSnapshotTests.podspec @@ -15,8 +15,8 @@ module SnapshotPodspecHelper source_files = Dir["components/#{@name}/tests/snapshot/*.{h,m,swift}"] supplemental_files = Dir["components/#{@name}/tests/snapshot/supplemental/*.{h,m,swift}"] example_files = Dir["components/#{@name}/examples/tests/snapshot/*.{h,m,swift}"] - theming_files = Dir["components/#{@name}/tests/snapshot/Theming/*.{h,m,swift}"] - return source_files + supplemental_files + example_files + theming_files + extension_files = Dir["components/#{@name}/tests/snapshot/*/*.{h,m,swift}"] + return source_files + supplemental_files + example_files + extension_files end return [] end diff --git a/catalog/MDCCatalog.xcodeproj/xcshareddata/xcschemes/MDCCatalog.xcscheme b/catalog/MDCCatalog.xcodeproj/xcshareddata/xcschemes/MDCCatalog.xcscheme index bd8953157f3..d97f16eb9da 100644 --- a/catalog/MDCCatalog.xcodeproj/xcshareddata/xcschemes/MDCCatalog.xcscheme +++ b/catalog/MDCCatalog.xcodeproj/xcshareddata/xcschemes/MDCCatalog.xcscheme @@ -28,7 +28,7 @@ buildForAnalyzing = "NO"> @@ -42,7 +42,7 @@ buildForAnalyzing = "NO"> @@ -56,7 +56,7 @@ buildForAnalyzing = "NO"> @@ -75,7 +75,7 @@ skipped = "NO"> @@ -85,7 +85,7 @@ skipped = "NO"> @@ -95,7 +95,7 @@ skipped = "NO"> @@ -105,7 +105,7 @@ skipped = "NO"> @@ -115,7 +115,7 @@ skipped = "NO"> @@ -125,7 +125,7 @@ skipped = "NO"> @@ -135,7 +135,7 @@ skipped = "NO"> @@ -145,7 +145,7 @@ skipped = "NO"> @@ -155,7 +155,7 @@ skipped = "NO"> @@ -165,7 +165,7 @@ skipped = "NO"> @@ -175,7 +175,7 @@ skipped = "NO"> @@ -185,7 +185,7 @@ skipped = "NO"> @@ -195,7 +195,7 @@ skipped = "NO"> @@ -205,7 +205,7 @@ skipped = "NO"> @@ -215,7 +215,7 @@ skipped = "NO"> @@ -225,7 +225,7 @@ skipped = "NO"> @@ -235,7 +235,7 @@ skipped = "NO"> @@ -245,7 +245,7 @@ skipped = "NO"> @@ -255,7 +255,7 @@ skipped = "NO"> @@ -265,7 +265,7 @@ skipped = "NO"> @@ -275,7 +275,7 @@ skipped = "NO"> @@ -285,7 +285,7 @@ skipped = "NO"> @@ -295,7 +295,7 @@ skipped = "NO"> @@ -305,7 +305,7 @@ skipped = "NO"> @@ -315,7 +315,7 @@ skipped = "NO"> @@ -325,7 +325,7 @@ skipped = "NO"> @@ -335,7 +335,7 @@ skipped = "NO"> @@ -345,7 +345,7 @@ skipped = "NO"> @@ -355,7 +355,7 @@ skipped = "NO"> @@ -365,7 +365,7 @@ skipped = "NO"> @@ -375,7 +375,7 @@ skipped = "NO"> @@ -385,7 +385,7 @@ skipped = "NO"> @@ -395,7 +395,7 @@ skipped = "NO"> @@ -405,7 +405,7 @@ skipped = "NO"> @@ -415,7 +415,7 @@ skipped = "NO"> @@ -425,7 +425,7 @@ skipped = "NO"> @@ -435,7 +435,7 @@ skipped = "NO"> @@ -445,7 +445,7 @@ skipped = "NO"> @@ -455,7 +455,7 @@ skipped = "NO"> @@ -465,7 +465,7 @@ skipped = "NO"> @@ -475,7 +475,7 @@ skipped = "NO"> @@ -485,7 +485,7 @@ skipped = "NO"> @@ -495,7 +495,7 @@ skipped = "NO"> @@ -505,7 +505,7 @@ skipped = "NO"> @@ -515,7 +515,7 @@ skipped = "NO"> @@ -525,7 +525,7 @@ skipped = "NO"> @@ -535,7 +535,7 @@ skipped = "NO"> @@ -545,7 +545,7 @@ skipped = "NO"> @@ -555,7 +555,7 @@ skipped = "NO"> @@ -565,7 +565,7 @@ skipped = "NO"> @@ -575,7 +575,7 @@ skipped = "NO"> @@ -585,7 +585,7 @@ skipped = "NO"> @@ -595,7 +595,7 @@ skipped = "NO"> @@ -605,7 +605,7 @@ skipped = "NO"> @@ -615,7 +615,7 @@ skipped = "NO"> @@ -625,7 +625,7 @@ skipped = "NO"> @@ -635,7 +635,7 @@ skipped = "NO"> @@ -645,7 +645,7 @@ skipped = "NO"> @@ -655,7 +655,7 @@ skipped = "NO"> @@ -665,7 +665,7 @@ skipped = "NO"> @@ -675,7 +675,7 @@ skipped = "NO"> @@ -685,7 +685,7 @@ skipped = "NO"> @@ -695,7 +695,7 @@ skipped = "NO"> @@ -705,9 +705,9 @@ skipped = "NO"> diff --git a/catalog/MDCDragons.xcodeproj/xcshareddata/xcschemes/MDCDragons.xcscheme b/catalog/MDCDragons.xcodeproj/xcshareddata/xcschemes/MDCDragons.xcscheme index 9c1cf104573..329e316fec5 100644 --- a/catalog/MDCDragons.xcodeproj/xcshareddata/xcschemes/MDCDragons.xcscheme +++ b/catalog/MDCDragons.xcodeproj/xcshareddata/xcschemes/MDCDragons.xcscheme @@ -28,7 +28,7 @@ buildForAnalyzing = "NO"> @@ -42,7 +42,7 @@ buildForAnalyzing = "NO"> @@ -60,7 +60,7 @@ skipped = "NO"> @@ -70,7 +70,7 @@ skipped = "NO"> @@ -80,7 +80,7 @@ skipped = "NO"> @@ -90,7 +90,7 @@ skipped = "NO"> @@ -100,7 +100,7 @@ skipped = "NO"> @@ -110,7 +110,7 @@ skipped = "NO"> @@ -120,7 +120,7 @@ skipped = "NO"> @@ -130,7 +130,7 @@ skipped = "NO"> @@ -140,7 +140,7 @@ skipped = "NO"> @@ -150,7 +150,7 @@ skipped = "NO"> @@ -160,7 +160,7 @@ skipped = "NO"> @@ -170,7 +170,7 @@ skipped = "NO"> @@ -180,7 +180,7 @@ skipped = "NO"> @@ -190,7 +190,7 @@ skipped = "NO"> @@ -200,7 +200,7 @@ skipped = "NO"> @@ -210,7 +210,7 @@ skipped = "NO"> @@ -220,7 +220,7 @@ skipped = "NO"> @@ -230,7 +230,7 @@ skipped = "NO"> @@ -240,7 +240,7 @@ skipped = "NO"> @@ -250,7 +250,7 @@ skipped = "NO"> @@ -260,7 +260,7 @@ skipped = "NO"> @@ -270,7 +270,7 @@ skipped = "NO"> @@ -280,7 +280,7 @@ skipped = "NO"> @@ -290,7 +290,7 @@ skipped = "NO"> @@ -300,7 +300,7 @@ skipped = "NO"> @@ -310,7 +310,7 @@ skipped = "NO"> @@ -320,7 +320,7 @@ skipped = "NO"> @@ -330,7 +330,7 @@ skipped = "NO"> @@ -340,7 +340,7 @@ skipped = "NO"> @@ -350,7 +350,7 @@ skipped = "NO"> @@ -360,7 +360,7 @@ skipped = "NO"> @@ -370,7 +370,7 @@ skipped = "NO"> @@ -380,7 +380,7 @@ skipped = "NO"> @@ -390,7 +390,7 @@ skipped = "NO"> @@ -400,7 +400,7 @@ skipped = "NO"> @@ -410,7 +410,7 @@ skipped = "NO"> @@ -420,7 +420,7 @@ skipped = "NO"> @@ -430,7 +430,7 @@ skipped = "NO"> @@ -440,7 +440,7 @@ skipped = "NO"> @@ -450,7 +450,7 @@ skipped = "NO"> @@ -460,7 +460,7 @@ skipped = "NO"> @@ -470,7 +470,7 @@ skipped = "NO"> @@ -480,7 +480,7 @@ skipped = "NO"> @@ -490,7 +490,7 @@ skipped = "NO"> @@ -500,7 +500,7 @@ skipped = "NO"> @@ -510,7 +510,7 @@ skipped = "NO"> @@ -520,7 +520,7 @@ skipped = "NO"> @@ -530,7 +530,7 @@ skipped = "NO"> @@ -540,7 +540,7 @@ skipped = "NO"> @@ -550,7 +550,7 @@ skipped = "NO"> @@ -560,7 +560,7 @@ skipped = "NO"> @@ -570,7 +570,7 @@ skipped = "NO"> @@ -580,7 +580,7 @@ skipped = "NO"> @@ -590,7 +590,7 @@ skipped = "NO"> @@ -600,7 +600,7 @@ skipped = "NO"> @@ -610,7 +610,7 @@ skipped = "NO"> @@ -620,7 +620,7 @@ skipped = "NO"> @@ -630,7 +630,7 @@ skipped = "NO"> @@ -640,7 +640,7 @@ skipped = "NO"> @@ -650,7 +650,7 @@ skipped = "NO"> @@ -660,7 +660,7 @@ skipped = "NO"> @@ -670,7 +670,7 @@ skipped = "NO"> @@ -680,7 +680,7 @@ skipped = "NO"> @@ -690,9 +690,9 @@ skipped = "NO"> diff --git a/catalog/Podfile b/catalog/Podfile index c55ebe1f3ab..f0a922ddab3 100644 --- a/catalog/Podfile +++ b/catalog/Podfile @@ -73,7 +73,7 @@ target "MDCCatalog" do 'ActionSheet+ColorThemer/UnitTests', 'BottomNavigation/UnitTests', 'ButtonBar+Theming/UnitTests', - 'Tabs2/UnitTests', + 'Tabs+TabBarView/UnitTests', ] pod 'MaterialComponentsSnapshotTests', :path => '../', :testspecs => [ 'SnapshotTests' diff --git a/components/Tabs/BUILD b/components/Tabs/BUILD index d3863c4ac95..eefeaf6fb30 100644 --- a/components/Tabs/BUILD +++ b/components/Tabs/BUILD @@ -91,10 +91,15 @@ mdc_extension_objc_library( ], ) +mdc_extension_objc_library( + name = "TabBarView", +) + mdc_examples_objc_library( name = "ObjcExamples", deps = [ ":ColorThemer", + ":TabBarView", ":Tabs", ":TypographyThemer", "//components/AppBar", @@ -133,6 +138,13 @@ mdc_objc_library( visibility = ["//visibility:private"], ) +mdc_objc_library( + name = "privateTabBarView", + hdrs = native.glob(["src/TabBarView/private/*.h"]), + includes = ["src/TabBarView/private"], + visibility = ["//visibility:private"], +) + mdc_objc_library( name = "unit_test_sources", testonly = 1, @@ -173,20 +185,38 @@ mdc_objc_library( ], ) +mdc_objc_library( + name = "unit_test_tabbarview_sources", + srcs = native.glob([ + "tests/unit/TabBarView/*.m", + ]), + sdk_frameworks = [ + "CoreGraphics", + "XCTest", + ], + deps = [ + ":TabBarView", + ":privateTabBarView", + ], +) + mdc_unit_test_suite( name = "unit_tests", deps = [ ":unit_test_sources", + ":unit_test_tabbarview_sources", ":unit_test_theming_sources", ], ) mdc_snapshot_objc_library( name = "snapshot_test_lib", - extra_srcs = native.glob(["tests/snapshot/Theming/*.m"]), + extra_srcs = native.glob(["tests/snapshot/*/*.m"]), deps = [ + ":TabBarView", ":Tabs", ":Theming", + ":privateTabBarView", ], ) diff --git a/components/Tabs2/src/MDCTabBarView.h b/components/Tabs/src/TabBarView/MDCTabBarView.h similarity index 100% rename from components/Tabs2/src/MDCTabBarView.h rename to components/Tabs/src/TabBarView/MDCTabBarView.h diff --git a/components/Tabs2/src/MDCTabBarView.m b/components/Tabs/src/TabBarView/MDCTabBarView.m similarity index 100% rename from components/Tabs2/src/MDCTabBarView.m rename to components/Tabs/src/TabBarView/MDCTabBarView.m diff --git a/components/Tabs2/src/MaterialTabs2.h b/components/Tabs/src/TabBarView/MaterialTabs+TabBarView.h similarity index 100% rename from components/Tabs2/src/MaterialTabs2.h rename to components/Tabs/src/TabBarView/MaterialTabs+TabBarView.h diff --git a/components/Tabs2/src/private/MDCTabBarViewItemView.h b/components/Tabs/src/TabBarView/private/MDCTabBarViewItemView.h similarity index 100% rename from components/Tabs2/src/private/MDCTabBarViewItemView.h rename to components/Tabs/src/TabBarView/private/MDCTabBarViewItemView.h diff --git a/components/Tabs2/src/private/MDCTabBarViewItemView.m b/components/Tabs/src/TabBarView/private/MDCTabBarViewItemView.m similarity index 100% rename from components/Tabs2/src/private/MDCTabBarViewItemView.m rename to components/Tabs/src/TabBarView/private/MDCTabBarViewItemView.m diff --git a/components/Tabs2/tests/snapshot/MDCTabBarViewItemViewSnapshotTests.m b/components/Tabs/tests/snapshot/TabBarView/MDCTabBarViewItemViewSnapshotTests.m similarity index 96% rename from components/Tabs2/tests/snapshot/MDCTabBarViewItemViewSnapshotTests.m rename to components/Tabs/tests/snapshot/TabBarView/MDCTabBarViewItemViewSnapshotTests.m index 38f6d4b4996..93d3c24a6f5 100644 --- a/components/Tabs2/tests/snapshot/MDCTabBarViewItemViewSnapshotTests.m +++ b/components/Tabs/tests/snapshot/TabBarView/MDCTabBarViewItemViewSnapshotTests.m @@ -15,7 +15,7 @@ #import #import -#import "../../src/private/MDCTabBarViewItemView.h" +#import "../../../src/TabBarView/private/MDCTabBarViewItemView.h" #import "MaterialSnapshot.h" @interface MDCTabBarViewItemViewSnapshotTests : MDCSnapshotTestCase diff --git a/components/Tabs2/tests/snapshot/MDCTabBarViewSnapshotTests.m b/components/Tabs/tests/snapshot/TabBarView/MDCTabBarViewSnapshotTests.m similarity index 100% rename from components/Tabs2/tests/snapshot/MDCTabBarViewSnapshotTests.m rename to components/Tabs/tests/snapshot/TabBarView/MDCTabBarViewSnapshotTests.m diff --git a/components/Tabs2/tests/unit/MDCTabBarViewItemViewTests.m b/components/Tabs/tests/unit/TabBarView/MDCTabBarViewItemViewTests.m similarity index 97% rename from components/Tabs2/tests/unit/MDCTabBarViewItemViewTests.m rename to components/Tabs/tests/unit/TabBarView/MDCTabBarViewItemViewTests.m index 38ea66f538c..019d612e13c 100644 --- a/components/Tabs2/tests/unit/MDCTabBarViewItemViewTests.m +++ b/components/Tabs/tests/unit/TabBarView/MDCTabBarViewItemViewTests.m @@ -15,7 +15,7 @@ #import #import -#import "../../src/private/MDCTabBarViewItemView.h" +#import "../../../src/TabBarView/private/MDCTabBarViewItemView.h" // Minimum width of an item view. static const CGFloat kMinWidth = 90; diff --git a/components/Tabs2/tests/unit/MDCTabBarViewTests.m b/components/Tabs/tests/unit/TabBarView/MDCTabBarViewTests.m similarity index 100% rename from components/Tabs2/tests/unit/MDCTabBarViewTests.m rename to components/Tabs/tests/unit/TabBarView/MDCTabBarViewTests.m diff --git a/components/Tabs2/BUILD b/components/Tabs2/BUILD deleted file mode 100644 index e481aefd3d3..00000000000 --- a/components/Tabs2/BUILD +++ /dev/null @@ -1,75 +0,0 @@ -# Copyright 2019-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. - -load( - "//:material_components_ios.bzl", - "mdc_examples_objc_library", - "mdc_objc_library", - "mdc_public_objc_library", - "mdc_snapshot_objc_library", - "mdc_snapshot_test", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "Tabs2", - visibility = ["//visibility:private"], -) - -mdc_objc_library( - name = "privateHeaders", - hdrs = glob(["src/private/*.h"]), - testonly = 1, -) - -mdc_examples_objc_library( - name = "ObjcExamples", - deps = [ - ":Tabs2", - "//components/schemes/Container", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - sdk_frameworks = ["CoreGraphics"], - deps = [ - ":Tabs2", - ":privateHeaders", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ], -) - -mdc_snapshot_objc_library( - name = "snapshot_test_lib", - deps = [ - ":Tabs2", - ":privateHeaders", - ], -) - -mdc_snapshot_test( - name = "snapshot_tests", - deps = [":snapshot_test_lib"], -) diff --git a/components/Tabs2/examples/MDCTabBarViewTypicalExampleViewController.m b/components/Tabs2/examples/MDCTabBarViewTypicalExampleViewController.m deleted file mode 100644 index 11753be2804..00000000000 --- a/components/Tabs2/examples/MDCTabBarViewTypicalExampleViewController.m +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2019-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 - -#import -#import "MaterialTabs2.h" - -static NSString *const kExampleTitle = @"TabBarView"; - -/** - Typical use example showing how to place an @c MDCTabBarView within another view. - */ -@interface MDCTabBarViewTypicalExampleViewController : UIViewController - -/** The tab bar for this example. */ -@property(nonatomic, strong) MDCTabBarView *tabBar; - -/** The container scheme injected into this example. */ -@property(nonatomic, strong) id containerScheme; - -@end - -@implementation MDCTabBarViewTypicalExampleViewController - -- (void)viewDidLoad { - [super viewDidLoad]; - self.title = kExampleTitle; - - if (!self.containerScheme) { - self.containerScheme = [[MDCContainerScheme alloc] init]; - } - - self.view.backgroundColor = self.containerScheme.colorScheme.backgroundColor; - - self.tabBar = [[MDCTabBarView alloc] init]; - CGSize barIntrinsicContentSize = self.tabBar.intrinsicContentSize; - self.tabBar.bounds = CGRectMake(0, 0, 0, barIntrinsicContentSize.width); - // TODO: Change this to theming (or at least .primaryColor) once we have content. - self.tabBar.backgroundColor = self.containerScheme.colorScheme.primaryColorVariant; - self.tabBar.translatesAutoresizingMaskIntoConstraints = NO; - [self.view addSubview:self.tabBar]; - - if (@available(iOS 11.0, *)) { - [self.view.layoutMarginsGuide.topAnchor constraintEqualToAnchor:self.tabBar.topAnchor].active = - YES; - } else { - [self.topLayoutGuide.bottomAnchor constraintEqualToAnchor:self.tabBar.topAnchor].active = YES; - } - [self.view.leftAnchor constraintEqualToAnchor:self.tabBar.leftAnchor].active = YES; - [self.view.rightAnchor constraintEqualToAnchor:self.tabBar.rightAnchor].active = YES; -} - -@end - -#pragma mark - CatalogByConvention -@implementation MDCTabBarViewTypicalExampleViewController (CatalogByConvention) - -+ (NSDictionary *)catalogMetadata { - return @{ - @"breadcrumbs" : @[ @"Tab Bar", kExampleTitle ], - @"primaryDemo" : @NO, - @"presentable" : @NO, - }; -} - -@end