Skip to content

Commit 673e77e

Browse files
committed
MainTabBarController: Removes unneeded setup
1 parent a04e991 commit 673e77e

File tree

1 file changed

+1
-38
lines changed

1 file changed

+1
-38
lines changed

WooCommerce/Classes/ViewRelated/MainTabBarController.swift

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Yosemite
55

66
/// Enum representing the individual tabs
77
///
8-
enum WooTab: Int, CustomStringConvertible {
8+
enum WooTab: Int {
99

1010
/// My Store Tab
1111
///
@@ -18,28 +18,6 @@ enum WooTab: Int, CustomStringConvertible {
1818
/// Notifications Tab
1919
///
2020
case notifications = 2
21-
22-
var description: String {
23-
switch self {
24-
case .myStore:
25-
return NSLocalizedString("My store", comment: "My store tab title")
26-
case .orders:
27-
return NSLocalizedString("Orders", comment: "Orders tab title")
28-
case .notifications:
29-
return NSLocalizedString("Notifications", comment: "Notifications tab title")
30-
}
31-
}
32-
33-
var tabIcon: UIImage {
34-
switch self {
35-
case .myStore:
36-
return Gridicon.iconOfType(.statsAlt)
37-
case .orders:
38-
return Gridicon.iconOfType(.pages)
39-
case .notifications:
40-
return Gridicon.iconOfType(.bell)
41-
}
42-
}
4321
}
4422

4523

@@ -62,24 +40,9 @@ class MainTabBarController: UITabBarController {
6240

6341
override func viewDidLoad() {
6442
super.viewDidLoad()
65-
setupTabBar()
6643
setNeedsStatusBarAppearanceUpdate() // call this to refresh status bar changes happening at runtime
6744
}
6845

69-
private func setupTabBar() {
70-
guard let items = tabBar.items else {
71-
fatalError()
72-
}
73-
74-
for (index, item) in items.enumerated() {
75-
guard let tab = WooTab(rawValue: index) else {
76-
fatalError()
77-
}
78-
item.title = tab.description
79-
item.image = tab.tabIcon
80-
}
81-
}
82-
8346
override func tabBar(_ tabBar: UITabBar, didSelect item: UITabBarItem) {
8447
guard let currentlySelectedTab = WooTab(rawValue: selectedIndex),
8548
let userSelectedIndex = tabBar.items?.index(of: item),

0 commit comments

Comments
 (0)