-
Notifications
You must be signed in to change notification settings - Fork 69
/
Copy pathFilterListViewController.swift
47 lines (38 loc) · 1.45 KB
/
FilterListViewController.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//
// FilterListViewController.swift
// FOSSAsia
//
// Created by Jurvis Tan on 4/2/16.
// Copyright © 2016 FossAsia. All rights reserved.
//
import UIKit
class FilterListViewController: UIViewController {
fileprivate let kFilterCellReuseIdentifier = "FilterCell"
@IBOutlet weak var filterTableView: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
filterTableView.dataSource = self
self.navigationController?.navigationBar.tintColor = Colors.mainRedColor
}
@IBAction func doneButtonPressed(_ sender: AnyObject) {
self.navigationController?.dismiss(animated: true, completion: nil)
}
}
extension FilterListViewController: UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return Constants.numberOfTracks
}
func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
if section == 0 {
return "Tracks"
}
return ""
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = self.filterTableView.dequeueReusableCell(withIdentifier: kFilterCellReuseIdentifier, for: indexPath) as! FilterCell
let trackId = (indexPath as NSIndexPath).row + 1
let trackViewModel = TrackViewModel(Event.Track(rawValue: trackId)!)
cell.configure(trackViewModel)
return cell
}
}