Cleaned up some code

This commit is contained in:
Deniz Duezgoeren
2019-08-23 13:04:36 +02:00
parent 6bb14d659d
commit c92d47f224
8 changed files with 17 additions and 85 deletions
+2 -21
View File
@@ -17,7 +17,6 @@ class PlanViewController : UIViewController, UICollectionViewDataSource, UIColle
var substs = [SubstModel]()
let refreshControl = UIRefreshControl()
let df = DataFetcher.sharedInstance
let planPrefs = UserDefaults.standard
let layout = MagazineLayout()
var collectionView: UICollectionView
var url = ""
@@ -28,10 +27,6 @@ class PlanViewController : UIViewController, UICollectionViewDataSource, UIColle
super.init(coder: decoder)
}
func getToolbarBottomAnchor() -> NSLayoutYAxisAnchor {
return view.topAnchor
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
@@ -68,14 +63,7 @@ class PlanViewController : UIViewController, UICollectionViewDataSource, UIColle
override func viewDidLoad() {
super.viewDidLoad()
if let tabItems = self.tabBarController?.tabBar.items {
let tabItem = tabItems[1]
if self.planPrefs.integer(forKey: "personalPlanCount") != 0 {
tabItem.badgeValue = "\(self.planPrefs.integer(forKey: "personalPlanCount"))"
} else {
tabItem.badgeValue = nil
}
}
self.df.setTabBarBadge(for: self.tabBarController?.tabBar.items)
}
func getViewType() -> String {
@@ -95,14 +83,7 @@ class PlanViewController : UIViewController, UICollectionViewDataSource, UIColle
self.substs = substitutions as! [SubstModel]
self.collectionView.reloadData()
self.refreshControl.endRefreshing()
if let tabItems = self.tabBarController?.tabBar.items {
let tabItem = tabItems[1]
if self.planPrefs.integer(forKey: "personalPlanCount") != 0 {
tabItem.badgeValue = "\(self.planPrefs.integer(forKey: "personalPlanCount"))"
} else {
tabItem.badgeValue = nil
}
}
self.df.setTabBarBadge(for: self.tabBarController?.tabBar.items)
}
}