From 4936d2f0dc19601fa25e9700915cf10a83558a7f Mon Sep 17 00:00:00 2001 From: Apple Date: Fri, 26 May 2023 12:06:26 +0530 Subject: [PATCH 1/3] added curve designed and added didTapItem func to go on specific index of tab bar --- .../contents.xcworkspacedata | 7 +++ .../xcshareddata/IDEWorkspaceChecks.plist | 8 +++ .../Extensions/UIBezierPath+createCurve.swift | 8 +-- .../WaveTabBarController.swift | 63 ++++++++++++++++--- .../WaveTabBarPresenterBase.swift | 10 +-- 5 files changed, 79 insertions(+), 17 deletions(-) create mode 100644 Example/Pods/Pods.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 Example/Pods/Pods.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/Example/Pods/Pods.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Example/Pods/Pods.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/Example/Pods/Pods.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Example/Pods/Pods.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Example/Pods/Pods.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Example/Pods/Pods.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/WaveTab/Classes/Implementation/Extensions/UIBezierPath+createCurve.swift b/WaveTab/Classes/Implementation/Extensions/UIBezierPath+createCurve.swift index 2f3be5f..7a74d75 100644 --- a/WaveTab/Classes/Implementation/Extensions/UIBezierPath+createCurve.swift +++ b/WaveTab/Classes/Implementation/Extensions/UIBezierPath+createCurve.swift @@ -13,11 +13,11 @@ extension UIBezierPath { let path = UIBezierPath() path.move(to: .zero) path.addLine(to: CGPoint(x: center - (curve * 2), y: 0)) - path.addQuadCurve(to: CGPoint(x: center - curve, y: curve / 2), controlPoint: CGPoint(x: center - curve - curve / 7.5, y: 0)) + path.addQuadCurve(to: CGPoint(x: center - curve, y: curve / 2), controlPoint: CGPoint(x: center - curve - 13, y: 0)) path.addCurve(to: CGPoint(x: center + curve, y: curve / 2), - controlPoint1: CGPoint(x: center - curve + curve / 4, y: curve + curve / 2), - controlPoint2: CGPoint(x: center + curve - curve / 4, y: curve + curve / 2)) - path.addQuadCurve(to: CGPoint(x: center + (curve * 2), y: 0), controlPoint: CGPoint(x: center + curve + curve / 7.5, y: 0)) + controlPoint1: CGPoint(x: center - curve + curve / 2, y: curve + curve / 2), + controlPoint2: CGPoint(x: center + curve - curve / 2, y: curve + curve / 1.8)) + path.addQuadCurve(to: CGPoint(x: center + (curve * 2), y: 0), controlPoint: CGPoint(x: center + curve + 13, y: 0)) path.addLine(to: CGPoint(x: tabBar.bounds.width, y: 0)) path.addLine(to: CGPoint(x: tabBar.bounds.width, y: tabBar.bounds.height)) path.addLine(to: CGPoint(x: 0, y: tabBar.bounds.height)) diff --git a/WaveTab/Classes/Implementation/Wave Tab Bar Controller/WaveTabBarController.swift b/WaveTab/Classes/Implementation/Wave Tab Bar Controller/WaveTabBarController.swift index 5c3442d..3117fe6 100644 --- a/WaveTab/Classes/Implementation/Wave Tab Bar Controller/WaveTabBarController.swift +++ b/WaveTab/Classes/Implementation/Wave Tab Bar Controller/WaveTabBarController.swift @@ -49,6 +49,10 @@ open class WaveTabBarController: UITabBarController, WaveTabBarProtocol { presenter.viewDidLoad() } +// open override func viewWillAppear(_ animated: Bool) { +// presenter.viewDidLoad() +// } + open override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) @@ -60,6 +64,10 @@ open class WaveTabBarController: UITabBarController, WaveTabBarProtocol { open override func tabBar(_ tabBar: UITabBar, didSelect item: UITabBarItem) { presenter.tabBarDidSelectItem(with: item.tag) } + open func didTapItem(tag:Int){ + presenter.tabBarDidSelectItem(with: tag) + + } open override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { super.viewWillTransition(to: size, with: coordinator) @@ -99,14 +107,39 @@ open class WaveTabBarController: UITabBarController, WaveTabBarProtocol { tabBar.layer.insertSublayer(waveSubLayer, above: tabBar.layer.sublayers?.first) } +// func setupCircle(_ width: Float) { +// circle = UIView(frame: CGRect(x: 0.0, y: 0.0, width: CGFloat(width), height: CGFloat(width))) +// circle?.layer.cornerRadius = CGFloat(width) / 2 +// circle?.center = CGPoint(x: tabBarItems[safeSelectedIndex].center.x, y: 0.0) +// //circle?.layer.borderWidth = Constants.borderWidth +// //circle?.layer.borderColor = Constants.borderColor +// // circle?.layer.cornerRadius = 17 +// circle?.removeFromSuperview() +// circle?.clipsToBounds = true; +// circle?.backgroundColor = UIColor.white +// circle?.layer.shadowColor = UIColor.lightGray.cgColor +// circle?.layer.shadowOpacity = 0.8 +// circle?.layer.shadowOffset = CGSize(width: 0.0, height: 0.0) +// circle?.layer.shadowRadius = 6.0 +// circle?.layer.masksToBounds = false +// tabBar.addSubview(circle!) +// } func setupCircle(_ width: Float) { + circle?.removeFromSuperview() // ->> Add this line circle = UIView(frame: CGRect(x: 0.0, y: 0.0, width: CGFloat(width), height: CGFloat(width))) circle?.layer.cornerRadius = CGFloat(width) / 2 circle?.center = CGPoint(x: tabBarItems[safeSelectedIndex].center.x, y: 0.0) - circle?.layer.borderWidth = Constants.borderWidth - circle?.layer.borderColor = Constants.borderColor - tabBar.addSubview(circle!) + circle?.clipsToBounds = true; + //circle?.backgroundColor = UIColor.white + circle?.layer.shadowColor = UIColor.lightGray.cgColor + circle?.layer.shadowOpacity = 0.8 + circle?.layer.shadowOffset = CGSize(width: 0.0, height: 0.0) + circle?.layer.shadowRadius = 6.0 + circle?.layer.masksToBounds = false + tabBar.addSubview(circle!) } + + func updateCircleSize(_ radius: Float) { guard let circle = circle else { return } @@ -144,13 +177,25 @@ open class WaveTabBarController: UITabBarController, WaveTabBarProtocol { } } +// func setupImageView(_ center: Float) { +// let image = viewControllers?[safeSelectedIndex].tabBarItem.selectedImage?.withRenderingMode(.alwaysTemplate) +// imageView?.removeFromSuperview() +// imageView = UIImageView(image: image) +// imageView?.contentMode = UIView.ContentMode.scaleAspectFit +// imageView?.tintColor = tabBar.tintColor +// imageView?.contentMode = .scaleAspectFit +// circle?.addSubview(imageView!) +// imageView?.center = CGPoint(x: CGFloat(center), y: CGFloat(center)) +// } func setupImageView(_ center: Float) { - let image = viewControllers?[safeSelectedIndex].tabBarItem.selectedImage?.withRenderingMode(.alwaysTemplate) - imageView = UIImageView(image: image) - imageView?.contentMode = UIView.ContentMode.scaleAspectFit - imageView?.tintColor = tabBar.tintColor - circle?.addSubview(imageView!) - imageView?.center = CGPoint(x: CGFloat(center), y: CGFloat(center)) + let image = viewControllers?[safeSelectedIndex].tabBarItem.selectedImage + imageView?.removeFromSuperview() // ->> Add this line + imageView = UIImageView(image: image) + imageView?.tintColor = UIColor.init(red: 0/255, green: 90.0/255, blue: 159.0/255, alpha: 1) + imageView?.contentMode = UIView.ContentMode.scaleAspectFit + circle?.addSubview(imageView!) + imageView?.center = CGPoint(x: CGFloat(center), y: CGFloat(center)) + // imageView?.backgroundColor = UIColor.red } func updateImageViewSize(_ center: Float) { diff --git a/WaveTab/Classes/Implementation/Wave Tab Bar Controller/WaveTabBarPresenterBase.swift b/WaveTab/Classes/Implementation/Wave Tab Bar Controller/WaveTabBarPresenterBase.swift index d20f465..451fe55 100644 --- a/WaveTab/Classes/Implementation/Wave Tab Bar Controller/WaveTabBarPresenterBase.swift +++ b/WaveTab/Classes/Implementation/Wave Tab Bar Controller/WaveTabBarPresenterBase.swift @@ -11,10 +11,10 @@ class WaveTabBarPresenterBase: WaveTabBarPresenter { private struct Constants { - static let smallRadius: Float = 25 - static let bigRadius: Float = 30 - static let smallCircle: Float = 47 - static let bigCircle: Float = 57 + static let smallRadius: Float = 32//25 + static let bigRadius: Float = 37//30 + static let smallCircle: Float = 57//47 + static let bigCircle: Float = 67//57 static let circleAnimationDuration: TimeInterval = 0.2 static let waveAnimationDuration: TimeInterval = Constants.circleAnimationDuration * 2 static let showHideAnimationDuration: TimeInterval = 0.3 @@ -46,6 +46,7 @@ class WaveTabBarPresenterBase: WaveTabBarPresenter { view.setupImageView((isPortrait ? Constants.bigCircle : Constants.smallCircle) / 2) view.setupTabBarColoring() view.setupTabBarBackground() + } func viewDidRotate(portrait portraitOrientation: Bool, at index: Int) { @@ -67,6 +68,7 @@ class WaveTabBarPresenterBase: WaveTabBarPresenter { view.moveCircle(over: Constants.circleAnimationDuration, offset: isPortrait ? Constants.bigRadius : Constants.smallRadius, down: true) + view.setupImageView((isPortrait ? Constants.bigCircle : Constants.smallCircle) / 2) } func viewWillLayoutSubviews() { From f6238979c2d36d7980b88700349a747e7adbfdd5 Mon Sep 17 00:00:00 2001 From: Apple Date: Fri, 26 May 2023 12:16:05 +0530 Subject: [PATCH 2/3] added curve designed and added didTapItem func to go on specific index of tab bar --- .../WaveTabBarController.swift | 29 ++----------------- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/WaveTab/Classes/Implementation/Wave Tab Bar Controller/WaveTabBarController.swift b/WaveTab/Classes/Implementation/Wave Tab Bar Controller/WaveTabBarController.swift index 3117fe6..d5562e9 100644 --- a/WaveTab/Classes/Implementation/Wave Tab Bar Controller/WaveTabBarController.swift +++ b/WaveTab/Classes/Implementation/Wave Tab Bar Controller/WaveTabBarController.swift @@ -107,23 +107,7 @@ open class WaveTabBarController: UITabBarController, WaveTabBarProtocol { tabBar.layer.insertSublayer(waveSubLayer, above: tabBar.layer.sublayers?.first) } -// func setupCircle(_ width: Float) { -// circle = UIView(frame: CGRect(x: 0.0, y: 0.0, width: CGFloat(width), height: CGFloat(width))) -// circle?.layer.cornerRadius = CGFloat(width) / 2 -// circle?.center = CGPoint(x: tabBarItems[safeSelectedIndex].center.x, y: 0.0) -// //circle?.layer.borderWidth = Constants.borderWidth -// //circle?.layer.borderColor = Constants.borderColor -// // circle?.layer.cornerRadius = 17 -// circle?.removeFromSuperview() -// circle?.clipsToBounds = true; -// circle?.backgroundColor = UIColor.white -// circle?.layer.shadowColor = UIColor.lightGray.cgColor -// circle?.layer.shadowOpacity = 0.8 -// circle?.layer.shadowOffset = CGSize(width: 0.0, height: 0.0) -// circle?.layer.shadowRadius = 6.0 -// circle?.layer.masksToBounds = false -// tabBar.addSubview(circle!) -// } +// func setupCircle(_ width: Float) { circle?.removeFromSuperview() // ->> Add this line circle = UIView(frame: CGRect(x: 0.0, y: 0.0, width: CGFloat(width), height: CGFloat(width))) @@ -177,16 +161,7 @@ open class WaveTabBarController: UITabBarController, WaveTabBarProtocol { } } -// func setupImageView(_ center: Float) { -// let image = viewControllers?[safeSelectedIndex].tabBarItem.selectedImage?.withRenderingMode(.alwaysTemplate) -// imageView?.removeFromSuperview() -// imageView = UIImageView(image: image) -// imageView?.contentMode = UIView.ContentMode.scaleAspectFit -// imageView?.tintColor = tabBar.tintColor -// imageView?.contentMode = .scaleAspectFit -// circle?.addSubview(imageView!) -// imageView?.center = CGPoint(x: CGFloat(center), y: CGFloat(center)) -// } +// func setupImageView(_ center: Float) { let image = viewControllers?[safeSelectedIndex].tabBarItem.selectedImage imageView?.removeFromSuperview() // ->> Add this line From c95c6deec2351e537517cad52a8ca276f1a27283 Mon Sep 17 00:00:00 2001 From: Apple Date: Sat, 27 May 2023 14:08:44 +0530 Subject: [PATCH 3/3] =?UTF-8?q?added=20curve=20designed=20and=20added=20di?= =?UTF-8?q?dTapItem=20func=20to=20show=20specicif=20tsb=20index=20is=20sel?= =?UTF-8?q?ected=20=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Example/Podfile | 2 +- Example/Pods/Pods.xcodeproj/project.pbxproj | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Example/Podfile b/Example/Podfile index b5402b5..90431d5 100644 --- a/Example/Podfile +++ b/Example/Podfile @@ -1,4 +1,4 @@ -platform :ios, '10.0' +platform :ios, '11.0' use_frameworks! target 'WaveTab_Example' do diff --git a/Example/Pods/Pods.xcodeproj/project.pbxproj b/Example/Pods/Pods.xcodeproj/project.pbxproj index f64962d..e87c751 100644 --- a/Example/Pods/Pods.xcodeproj/project.pbxproj +++ b/Example/Pods/Pods.xcodeproj/project.pbxproj @@ -444,7 +444,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "Target Support Files/Pods-WaveTab_Tests/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 9.3; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MACH_O_TYPE = staticlib; MODULEMAP_FILE = "Target Support Files/Pods-WaveTab_Tests/Pods-WaveTab_Tests.modulemap"; @@ -539,7 +539,7 @@ GCC_PREFIX_HEADER = "Target Support Files/WaveTab/WaveTab-prefix.pch"; INFOPLIST_FILE = "Target Support Files/WaveTab/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MODULEMAP_FILE = "Target Support Files/WaveTab/WaveTab.modulemap"; PRODUCT_MODULE_NAME = WaveTab; @@ -571,7 +571,7 @@ GCC_PREFIX_HEADER = "Target Support Files/WaveTab/WaveTab-prefix.pch"; INFOPLIST_FILE = "Target Support Files/WaveTab/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MODULEMAP_FILE = "Target Support Files/WaveTab/WaveTab.modulemap"; PRODUCT_MODULE_NAME = WaveTab; @@ -605,7 +605,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "Target Support Files/Pods-WaveTab_Example/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 9.3; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MACH_O_TYPE = staticlib; MODULEMAP_FILE = "Target Support Files/Pods-WaveTab_Example/Pods-WaveTab_Example.modulemap"; @@ -642,7 +642,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "Target Support Files/Pods-WaveTab_Example/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 9.3; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MACH_O_TYPE = staticlib; MODULEMAP_FILE = "Target Support Files/Pods-WaveTab_Example/Pods-WaveTab_Example.modulemap"; @@ -743,7 +743,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "Target Support Files/Pods-WaveTab_Tests/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 9.3; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MACH_O_TYPE = staticlib; MODULEMAP_FILE = "Target Support Files/Pods-WaveTab_Tests/Pods-WaveTab_Tests.modulemap";