Rewrote DataFetcher.swift to make it maintainable; added sorting algorithm, TODO: switch sorting algorithms

This commit is contained in:
Deniz Duezgoeren
2019-09-24 20:47:52 +02:00
parent d133a056ac
commit 8f261a019f
6 changed files with 209 additions and 118 deletions
+3 -3
View File
@@ -91,7 +91,7 @@ class PlanViewController : UICollectionViewController, UICollectionViewDelegateM
}
func getFromDatabase() -> [SubstModel] {
return self.df.getFromDatabase()
return self.df.getSubstitutionsFromDatabase()
}
func getRefreshViewString() -> String {
@@ -128,8 +128,9 @@ class PlanViewController : UICollectionViewController, UICollectionViewDelegateM
}
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: identifier, for: indexPath as IndexPath) as! PlanViewCell
var psa = false
let course = self.substs[indexPath.item].course
var image = df.getImage(from: course)
@@ -149,7 +150,6 @@ class PlanViewController : UICollectionViewController, UICollectionViewDelegateM
cell.group.textColor = #colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)
cell.course.textColor = #colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)
cell.additional.textColor = #colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)
psa = true
} else {
cell.date.text = self.substs[indexPath.item].date
cell.group.textColor = #colorLiteral(red: 0, green: 0, blue: 0, alpha: 1)