From a972c039ab6d26fac4b6073495de87728b368932 Mon Sep 17 00:00:00 2001 From: Emil Karimov Date: Sat, 29 Oct 2022 15:13:52 +0530 Subject: [PATCH] add can border setup --- Sources/EKTabBarController/EKFloatingBarView.swift | 9 ++++++++- Sources/EKTabBarController/EKTabBarController.swift | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Sources/EKTabBarController/EKFloatingBarView.swift b/Sources/EKTabBarController/EKFloatingBarView.swift index 877a2d3..3b387d0 100644 --- a/Sources/EKTabBarController/EKFloatingBarView.swift +++ b/Sources/EKTabBarController/EKFloatingBarView.swift @@ -20,11 +20,16 @@ class EKFloatingBarView: UIView { weak var delegate: EKFloatingBarViewDelegate? private let cornerRadius: CGFloat + private let borderWidth: CGFloat + private let borderColor: UIColor private var buttons: [UIButton] = [] - init(_ items: [UITabBarItem], cornerRadius: CGFloat = 20, backgroundColor: UIColor = .white) { + init(_ items: [UITabBarItem], cornerRadius: CGFloat = 20, backgroundColor: UIColor = .white, borderWidth: CGFloat, + borderColor: UIColor) { self.cornerRadius = cornerRadius + self.borderColor = borderColor + self.borderWidth = borderWidth super.init(frame: .zero) @@ -37,6 +42,8 @@ class EKFloatingBarView: UIView { super.layoutSubviews() layer.cornerRadius = cornerRadius + layer.borderColor = borderColor + layer.borderWidth = borderWidth } diff --git a/Sources/EKTabBarController/EKTabBarController.swift b/Sources/EKTabBarController/EKTabBarController.swift index eeee315..b65b92c 100644 --- a/Sources/EKTabBarController/EKTabBarController.swift +++ b/Sources/EKTabBarController/EKTabBarController.swift @@ -17,6 +17,8 @@ public final class EKTabBarController: UITabBarController { private let cornerRadius: CGFloat private let backColor: UIColor private let bottomSpace: CGFloat + private let borderWidth: CGFloat + private let borderColor: UIColor /// Initialize TabBar controller /// - Parameters: @@ -29,13 +31,18 @@ public final class EKTabBarController: UITabBarController { cornerRadius: CGFloat, backgroundColor: UIColor, insets: UIEdgeInsets = .init(top: 0, left: 16, bottom: 0, right: 16), - bottomSpace: CGFloat = 50) { + bottomSpace: CGFloat = 50, + borderWidth: CGFloat = 0, + borderColor: UIColor = .clear) { self.controllerItems = controllerItems self.insets = insets self.cornerRadius = cornerRadius self.backColor = backgroundColor self.bottomSpace = abs(bottomSpace) + + self.borderColor = borderColor + self.borderWidth = borderWidth super.init(nibName: nil, bundle: nil) }