Skip to content

Commit 329bec6

Browse files
committed
Added dotTag func
1 parent fd0e159 commit 329bec6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

WooCommerce/Classes/ViewRelated/MainTabBarController.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,25 +134,28 @@ extension MainTabBarController {
134134

135135
func showDotOn(_ tab: WooTab) {
136136
hideDotOn(tab)
137-
let tag = tab.rawValue + DotConstants.tagOffset
138137
let dot = UIView(frame: CGRect(x: DotConstants.xOffset,
139138
y: DotConstants.yOffset,
140139
width: DotConstants.diameter,
141140
height: DotConstants.diameter))
142-
dot.tag = tag
141+
dot.tag = dotTag(for: tab)
143142
dot.backgroundColor = StyleManager.wooAccent
144143
dot.layer.cornerRadius = (DotConstants.diameter / 2)
145144
tabBar.subviews[tab.rawValue].subviews.first?.insertSubview(dot, at: 1)
146145
}
147146

148147
func hideDotOn(_ tab: WooTab) {
149-
let tag = tab.rawValue + DotConstants.tagOffset
148+
let tag = dotTag(for: tab)
150149
if let subviews = tabBar.subviews[tab.rawValue].subviews.first?.subviews {
151150
for subview in subviews where subview.tag == tag {
152151
subview.removeFromSuperview()
153152
}
154153
}
155154
}
155+
156+
private func dotTag(for tab: WooTab) -> Int {
157+
return tab.rawValue + DotConstants.tagOffset
158+
}
156159
}
157160

158161

0 commit comments

Comments
 (0)