Skip to content

Commit c56b349

Browse files
author
Владислав Прусаков
committed
Fix some bugs
1 parent 887d94d commit c56b349

20 files changed

+258
-481
lines changed

Example/Podfile

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
use_frameworks!
2-
platform :ios, '13.0'
2+
platform :ios, '13.4'
33

44
target 'SideTabBar_Example' do
55
pod 'SideTabBar', :path => '../'
6-
7-
target 'SideTabBar_Tests' do
8-
inherit! :search_paths
9-
10-
11-
end
126
end

Example/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ EXTERNAL SOURCES:
1111
SPEC CHECKSUMS:
1212
SideTabBar: 5120d7bf8515597f1b9f6e08ee49353048247912
1313

14-
PODFILE CHECKSUM: 559e4019944bcd0795952bde172885d27b5bded8
14+
PODFILE CHECKSUM: 6befa2acf2ed279e0be7031241fd30398677dd8e
1515

16-
COCOAPODS: 1.7.5
16+
COCOAPODS: 1.8.4

Example/Pods/Manifest.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/Pods.xcodeproj/project.pbxproj

Lines changed: 176 additions & 342 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/Target Support Files/Pods-SideTabBar_Example/Pods-SideTabBar_Example.debug.xcconfig

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/Target Support Files/Pods-SideTabBar_Example/Pods-SideTabBar_Example.release.xcconfig

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/Target Support Files/Pods-SideTabBar_Tests/Pods-SideTabBar_Tests-Info.plist

Lines changed: 0 additions & 26 deletions
This file was deleted.

Example/Pods/Target Support Files/Pods-SideTabBar_Tests/Pods-SideTabBar_Tests-acknowledgements.markdown

Lines changed: 0 additions & 3 deletions
This file was deleted.

Example/Pods/Target Support Files/Pods-SideTabBar_Tests/Pods-SideTabBar_Tests-acknowledgements.plist

Lines changed: 0 additions & 29 deletions
This file was deleted.

Example/Pods/Target Support Files/Pods-SideTabBar_Tests/Pods-SideTabBar_Tests-dummy.m

Lines changed: 0 additions & 5 deletions
This file was deleted.

Example/Pods/Target Support Files/Pods-SideTabBar_Tests/Pods-SideTabBar_Tests-umbrella.h

Lines changed: 0 additions & 16 deletions
This file was deleted.

Example/Pods/Target Support Files/Pods-SideTabBar_Tests/Pods-SideTabBar_Tests.debug.xcconfig

Lines changed: 0 additions & 8 deletions
This file was deleted.

Example/Pods/Target Support Files/Pods-SideTabBar_Tests/Pods-SideTabBar_Tests.modulemap

Lines changed: 0 additions & 6 deletions
This file was deleted.

Example/Pods/Target Support Files/Pods-SideTabBar_Tests/Pods-SideTabBar_Tests.release.xcconfig

Lines changed: 0 additions & 8 deletions
This file was deleted.

Example/Pods/Target Support Files/SideTabBar/SideTabBar.xcconfig

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/SideTabBar.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@
321321
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
322322
GCC_WARN_UNUSED_FUNCTION = YES;
323323
GCC_WARN_UNUSED_VARIABLE = YES;
324-
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
324+
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
325325
MTL_ENABLE_DEBUG_INFO = YES;
326326
ONLY_ACTIVE_ARCH = YES;
327327
SDKROOT = iphoneos;
@@ -370,7 +370,7 @@
370370
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
371371
GCC_WARN_UNUSED_FUNCTION = YES;
372372
GCC_WARN_UNUSED_VARIABLE = YES;
373-
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
373+
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
374374
MTL_ENABLE_DEBUG_INFO = NO;
375375
SDKROOT = iphoneos;
376376
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
@@ -388,7 +388,7 @@
388388
DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
389389
DEVELOPMENT_TEAM = 8PYCRS3EA3;
390390
INFOPLIST_FILE = SideTabBar/Info.plist;
391-
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
391+
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
392392
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
393393
MODULE_NAME = ExampleApp;
394394
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
@@ -410,7 +410,7 @@
410410
DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
411411
DEVELOPMENT_TEAM = 8PYCRS3EA3;
412412
INFOPLIST_FILE = SideTabBar/Info.plist;
413-
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
413+
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
414414
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
415415
MODULE_NAME = ExampleApp;
416416
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";

Sources/SideTabBar/Extensions.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public extension UIBlurEffect {
2828
}
2929

3030
static func makeBlurThroughEffect(style: ThroughStyle) -> UIVisualEffect? {
31-
return (NSClassFromString("_UIBlurThroughEffect") as? UIVisualEffect.Type)?.perform(Selector("_blurThroughWithStyle:"), with: style.rawValue)?.takeRetainedValue() as? UIVisualEffect
31+
return (NSClassFromString("_UIBlurThroughEffect") as? UIVisualEffect.Type)?.perform(NSSelectorFromString("_blurThroughWithStyle:"), with: style.rawValue)?.takeRetainedValue() as? UIVisualEffect
3232
}
3333
}
3434

@@ -46,8 +46,8 @@ extension UIViewController {
4646

4747
func removeFromParentViewController() {
4848
self.willMove(toParent: nil)
49-
self.removeFromParent()
5049
self.view.removeFromSuperview()
50+
self.removeFromParent()
5151
}
5252

5353
/// Adds a child view controller pinning it view to edges of viewContainer

Sources/SideTabBar/SideTabBar.swift

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ open class SideTabBar: UIView {
7676
private weak var stackView: UIStackView!
7777
private weak var visualEffectView: UIVisualEffectView!
7878

79-
var visualEffect: UIVisualEffect = UIBlurEffect(style: .systemChromeMaterial) {
79+
var visualEffect: UIVisualEffect? = UIBlurEffect(style: .systemChromeMaterial) {
8080
didSet {
8181
self.visualEffectView?.effect = self.visualEffect
8282
}
@@ -86,8 +86,6 @@ open class SideTabBar: UIView {
8686
private var bottomItemsStackView: UIStackView!
8787
private var verticalSeparatorView: UIView!
8888

89-
var canDeselect = true
90-
9189
private var _topItems: [UITabBarItem]?
9290
private var _bottomItems: [UITabBarItem]?
9391

@@ -218,9 +216,7 @@ open class SideTabBar: UIView {
218216
self.delegate?.tabBar(self, didSelect: tabBarItem)
219217

220218
if selectedButton === button {
221-
if canDeselect {
222-
self.selectedItem = nil
223-
}
219+
self.selectedItem = nil
224220
} else {
225221
self.selectedItem = button.tabBarItem
226222
}

Sources/SideTabBar/SideTabBarController.swift

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,20 @@ open class SideTabBarController: UIViewController {
136136
}
137137

138138
/// A visual effect what used by default for tab bar and primary view.
139-
open var backgroundVisualEffect: UIVisualEffect = UIBlurEffect(style: .systemChromeMaterial) {
139+
open var backgroundVisualEffect: UIVisualEffect? = UIBlurEffect(style: .systemChromeMaterial) {
140140
didSet {
141141
self.primaryContainerView?.effect = self.backgroundVisualEffect
142142
self.tabBar?.visualEffect = self.backgroundVisualEffect
143143
}
144144
}
145145

146+
/// A background color used for primary view
147+
open var primaryBackgroundColor: UIColor? {
148+
didSet {
149+
self.primaryContainerView?.backgroundColor = self.primaryBackgroundColor
150+
}
151+
}
152+
146153
/// A color what used for dimming content view when primary display as overlay.
147154
open var overlayDimmingColor: UIColor = UIColor(white: 0, alpha: 0.3) {
148155
didSet {
@@ -316,7 +323,6 @@ open class SideTabBarController: UIViewController {
316323
self.additionalSafeAreaInsets.left = 0
317324
self.primaryRightConstraint.isActive = false
318325
self.setTabBarVisible(false, animated: false)
319-
self.tabBar.canDeselect = true
320326
self.primaryWidthConstraint.constant = Constants.detailHiddenWidth
321327
} else {
322328
self.setTabBarVisible(true, animated: false)
@@ -326,10 +332,8 @@ open class SideTabBarController: UIViewController {
326332

327333
switch displayMode {
328334
case .allVisible:
329-
self.tabBar.canDeselect = false
330335
self.primaryRightConstraint.isActive = true
331336
case .primaryHidden, .primaryOverlay, .primaryModal:
332-
self.tabBar.canDeselect = true
333337
self.primaryRightConstraint.isActive = false
334338
}
335339

@@ -488,11 +492,13 @@ open class SideTabBarController: UIViewController {
488492

489493
animator.addAnimations {
490494
self.overlayView.dismiss()
495+
self.selectedViewController?.view.alpha = 0
491496
self.view.layoutIfNeeded()
492497
}
493498

494499
animator.addCompletion { position in
495500
if position == .end {
501+
self.selectedViewController?.view.alpha = 1
496502
self.selectedViewController?.removeFromParentViewController()
497503
self.selectedViewController = nil
498504
self.displayMode = .primaryHidden
@@ -521,7 +527,6 @@ open class SideTabBarController: UIViewController {
521527

522528
switch displayMode {
523529
case .allVisible:
524-
self.tabBar.canDeselect = false
525530
self.primaryRightConstraint.isActive = true
526531
self.selectedViewController?.removeFromParentViewController()
527532
self.addChildViewController(viewController, viewContainer: self.primaryContainerView.contentView)
@@ -535,7 +540,6 @@ open class SideTabBarController: UIViewController {
535540
self.displayMode = .allVisible
536541
self.primaryWidthConstraint.constant = self.primaryWidth
537542
case .primaryModal, .primaryOverlay, .primaryHidden:
538-
self.tabBar.canDeselect = true
539543
self.selectedViewController?.removeFromParentViewController()
540544
self.addChildViewController(viewController, viewContainer: self.primaryContainerView.contentView)
541545
self.view.layoutIfNeeded()

0 commit comments

Comments
 (0)