Skip to content

Commit cb82185

Browse files
authored
Merge branch 'main' into bottomSheetContinuesAnimateDuringSafeAreaChange
2 parents 41e4023 + 1dfcb5f commit cb82185

File tree

3 files changed

+53
-13
lines changed

3 files changed

+53
-13
lines changed

Demos/FluentUIDemo_iOS/FluentUI.Demo/Demos/TabBarViewDemoController.swift

+15-1
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,15 @@ class TabBarViewDemoController: DemoController {
2020
private var showBadgeNumbers: Bool { return showBadgeNumbersSwitch.isOn }
2121
private var useHigherBadgeNumbers: Bool { return useHigherBadgeNumbersSwitch.isOn }
2222
private var useGradientSelection: Bool { return useGradientSelectionSwitch.isOn }
23+
private var blurBlackground: Bool { return blurBlackgroundSwitch.isOn }
24+
private var hideSeparatorSelection: Bool { return hideSeparatorSelectionSwitch.isOn }
2325

2426
private let itemTitleVisibilitySwitch = BrandedSwitch()
2527
private let showBadgeNumbersSwitch = BrandedSwitch()
2628
private let useHigherBadgeNumbersSwitch = BrandedSwitch()
2729
private let useGradientSelectionSwitch = BrandedSwitch()
30+
private let blurBlackgroundSwitch = BrandedSwitch()
31+
private let hideSeparatorSelectionSwitch = BrandedSwitch()
2832

2933
private lazy var incrementBadgeButton: Button = {
3034
return createButton(title: "+", action: #selector(incrementBadgeNumbers))
@@ -73,7 +77,14 @@ class TabBarViewDemoController: DemoController {
7377
addRow(text: "Use gradient selection", items: [useGradientSelectionSwitch], textWidth: Constants.switchSettingTextWidth)
7478
useGradientSelectionSwitch.addTarget(self, action: #selector(handleOnSwitchValueChanged), for: .valueChanged)
7579

76-
addRow(text: "Modify badge numbers", items: [incrementBadgeButton, decrementBadgeButton], textWidth: Constants.buttonSettingTextWidth)
80+
addRow(text: "Blur background", items: [blurBlackgroundSwitch], textWidth: Constants.switchSettingTextWidth)
81+
blurBlackgroundSwitch.addTarget(self, action: #selector(handleOnSwitchValueChanged), for: .valueChanged)
82+
blurBlackgroundSwitch.isOn = true
83+
84+
addRow(text: "Hide Separator", items: [hideSeparatorSelectionSwitch], textWidth: Constants.switchSettingTextWidth)
85+
hideSeparatorSelectionSwitch.addTarget(self, action: #selector(handleOnSwitchValueChanged), for: .valueChanged)
86+
87+
addRow(text: "Modify badge numbers", items: [decrementBadgeButton, incrementBadgeButton], textWidth: Constants.buttonSettingTextWidth)
7788

7889
setupTabBarView()
7990
updateBadgeButtons()
@@ -116,6 +127,9 @@ class TabBarViewDemoController: DemoController {
116127
updatedTabBarView.selectedItemGradient = gradient
117128
}
118129

130+
updatedTabBarView.backgroundIsBlurred = blurBlackground
131+
updatedTabBarView.separatorIsHidden = hideSeparatorSelection
132+
119133
updatedTabBarView.translatesAutoresizingMaskIntoConstraints = false
120134
view.addSubview(updatedTabBarView)
121135

Demos/FluentUIDemo_macOS/xcode/FluentUI.xcodeproj/project.pbxproj

+20-6
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
8F5368072295F4C10098AC8F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8F5368062295F4C10098AC8F /* Assets.xcassets */; };
2323
8F53680A2295F4C10098AC8F /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8F5368082295F4C10098AC8F /* MainMenu.xib */; };
2424
9252C6222C62A8B3009C9272 /* FluentUI in Frameworks */ = {isa = PBXBuildFile; productRef = 9252C6212C62A8B3009C9272 /* FluentUI */; };
25+
92AD71232D4062050089499E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8F5368062295F4C10098AC8F /* Assets.xcassets */; };
26+
92AD71252D4062080089499E /* FluentUI in Frameworks */ = {isa = PBXBuildFile; productRef = 92AD71242D4062080089499E /* FluentUI */; };
2527
9B4AEBAB2705206300B68020 /* TestFilledTemplateImageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B4AEBAA2705206300B68020 /* TestFilledTemplateImageViewController.swift */; };
2628
9B8661772A4F5DAE00FA4F78 /* TestColorProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B8661752A4F5C4800FA4F78 /* TestColorProvider.swift */; };
2729
A257F81E2512DE45002CAA6E /* TestColorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A257F81C2512DDF7002CAA6E /* TestColorViewController.swift */; };
@@ -138,12 +140,12 @@
138140
8F79192924589B6E00C84086 /* vi */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = vi; path = vi.lproj/MainMenu.strings; sourceTree = "<group>"; };
139141
8F931A6C22BD593300311764 /* FluentUI_unittest.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = FluentUI_unittest.xcconfig; sourceTree = "<group>"; };
140142
9252C61E2C62A881009C9272 /* fluentui-apple */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = "fluentui-apple"; path = ../../..; sourceTree = "<group>"; };
143+
92AD711E2D4061340089499E /* FluentUIUnitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FluentUIUnitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
141144
9B4AEBAA2705206300B68020 /* TestFilledTemplateImageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestFilledTemplateImageViewController.swift; sourceTree = "<group>"; };
142145
9B8661752A4F5C4800FA4F78 /* TestColorProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestColorProvider.swift; sourceTree = "<group>"; };
143146
A257F81C2512DDF7002CAA6E /* TestColorViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestColorViewController.swift; sourceTree = "<group>"; };
144147
AC97EFE3247541E100DADC99 /* TestButtonViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestButtonViewController.swift; sourceTree = "<group>"; };
145148
AC97EFE8247FAB1D00DADC99 /* TestSeparatorViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestSeparatorViewController.swift; sourceTree = "<group>"; };
146-
E61C96BB2295E8D60006561F /* FluentUIUnitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FluentUIUnitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
147149
E61C96CE2295ED8A0006561F /* FluentUI_framework.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = FluentUI_framework.xcconfig; sourceTree = "<group>"; };
148150
E61C96CF2295F6FE0006561F /* FluentUI_common.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = FluentUI_common.xcconfig; sourceTree = "<group>"; };
149151
E61C96D02295FA360006561F /* FluentUI_debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = FluentUI_debug.xcconfig; sourceTree = "<group>"; };
@@ -198,6 +200,7 @@
198200
isa = PBXFrameworksBuildPhase;
199201
buildActionMask = 2147483647;
200202
files = (
203+
92AD71252D4062080089499E /* FluentUI in Frameworks */,
201204
);
202205
runOnlyForDeploymentPostprocessing = 0;
203206
};
@@ -266,6 +269,7 @@
266269
E6A92D2424BEA85900562BCA /* libFluentUITestViewControllers.a */,
267270
E6A92D3624BEA91F00562BCA /* FluentUISwiftUITestApp.app */,
268271
3A42750F29677C3700F36FBE /* FluentUIDemoTests.xctest */,
272+
92AD711E2D4061340089499E /* FluentUIUnitTests.xctest */,
269273
);
270274
name = Products;
271275
sourceTree = "<group>";
@@ -404,20 +408,16 @@
404408
buildConfigurationList = E61C96C92295E8D60006561F /* Build configuration list for PBXNativeTarget "FluentUITests" */;
405409
buildPhases = (
406410
E61C96B72295E8D60006561F /* Sources */,
407-
E61C96B82295E8D60006561F /* Frameworks */,
408-
E61C96B92295E8D60006561F /* Resources */,
409411
);
410412
buildRules = (
411413
);
412414
dependencies = (
413-
9252C6262C62A8F6009C9272 /* PBXTargetDependency */,
414415
);
415416
name = FluentUITests;
416417
packageProductDependencies = (
417-
9252C6272C62A9F1009C9272 /* FluentUI */,
418418
);
419419
productName = FluentUITests;
420-
productReference = E61C96BB2295E8D60006561F /* FluentUIUnitTests.xctest */;
420+
productReference = 92AD711E2D4061340089499E /* FluentUIUnitTests.xctest */;
421421
productType = "com.apple.product-type.bundle.unit-test";
422422
};
423423
E6A92D2324BEA85900562BCA /* FluentUITestViewControllers */ = {
@@ -449,6 +449,7 @@
449449
buildRules = (
450450
);
451451
dependencies = (
452+
92AD71222D4061F20089499E /* PBXTargetDependency */,
452453
E6A92D4924BEA9AF00562BCA /* PBXTargetDependency */,
453454
);
454455
name = FluentUISwiftUITestApp;
@@ -573,6 +574,7 @@
573574
isa = PBXResourcesBuildPhase;
574575
buildActionMask = 2147483647;
575576
files = (
577+
92AD71232D4062050089499E /* Assets.xcassets in Resources */,
576578
E6A92D4024BEA92000562BCA /* Preview Assets.xcassets in Resources */,
577579
);
578580
runOnlyForDeploymentPostprocessing = 0;
@@ -664,6 +666,10 @@
664666
isa = PBXTargetDependency;
665667
productRef = 9252C6232C62A8DC009C9272 /* FluentUI */;
666668
};
669+
92AD71222D4061F20089499E /* PBXTargetDependency */ = {
670+
isa = PBXTargetDependency;
671+
productRef = 92AD71212D4061F20089499E /* FluentUI */;
672+
};
667673
E6A92D4724BEA9A600562BCA /* PBXTargetDependency */ = {
668674
isa = PBXTargetDependency;
669675
target = E6A92D2324BEA85900562BCA /* FluentUITestViewControllers */;
@@ -1032,6 +1038,14 @@
10321038
isa = XCSwiftPackageProductDependency;
10331039
productName = FluentUI;
10341040
};
1041+
92AD71212D4061F20089499E /* FluentUI */ = {
1042+
isa = XCSwiftPackageProductDependency;
1043+
productName = FluentUI;
1044+
};
1045+
92AD71242D4062080089499E /* FluentUI */ = {
1046+
isa = XCSwiftPackageProductDependency;
1047+
productName = FluentUI;
1048+
};
10351049
/* End XCSwiftPackageProductDependency section */
10361050
};
10371051
rootObject = E61C96A92295E8D60006561F /* Project object */;

Sources/FluentUI_iOS/Components/Tab Bar/TabBarView.swift

+18-6
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ open class TabBarView: UIView, TokenizedControl {
9797
/// - Parameter showsItemTitles: Determines whether or not to show the titles of the tab bar items.
9898
@objc public init(showsItemTitles: Bool = false) {
9999
self.showsItemTitles = showsItemTitles
100+
100101
super.init(frame: .zero)
101102

102103
backgroundView.translatesAutoresizingMaskIntoConstraints = false
@@ -155,16 +156,27 @@ open class TabBarView: UIView, TokenizedControl {
155156

156157
@objc public static let tabBarPadHeight: CGFloat = TabBarTokenSet.padHeight
157158

159+
@objc public var backgroundIsBlurred: Bool = true {
160+
didSet {
161+
if backgroundIsBlurred != oldValue {
162+
backgroundView.effect = backgroundIsBlurred ? UIBlurEffect(style: UIBlurEffect.Style.systemChromeMaterial) : nil
163+
}
164+
}
165+
}
166+
167+
@objc public var separatorIsHidden: Bool = false {
168+
didSet {
169+
if separatorIsHidden != oldValue {
170+
topBorderLine.isHidden = separatorIsHidden
171+
}
172+
}
173+
}
174+
158175
private struct Constants {
159176
static let maxTabCount: Int = 6
160177
}
161178

162-
private let backgroundView: UIVisualEffectView = {
163-
var style = UIBlurEffect.Style.regular
164-
style = .systemChromeMaterial
165-
166-
return UIVisualEffectView(effect: UIBlurEffect(style: style))
167-
}()
179+
private let backgroundView: UIVisualEffectView = UIVisualEffectView(effect: UIBlurEffect(style: UIBlurEffect.Style.systemChromeMaterial))
168180

169181
private lazy var heightConstraint: NSLayoutConstraint = stackView.heightAnchor.constraint(equalToConstant: traitCollection.userInterfaceIdiom == .phone ? TabBarTokenSet.phonePortraitHeight : TabBarTokenSet.padHeight)
170182

0 commit comments

Comments
 (0)