-
Notifications
You must be signed in to change notification settings - Fork 289
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added the ability to search for country/city.
- Loading branch information
Showing
7 changed files
with
346 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// | ||
// RegionListController.swift | ||
// Corona Tracker | ||
// | ||
// Created by Mohammad on 3/14/20. | ||
// Copyright © 2020 Samabox. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
class RegionListController: UITableViewController { | ||
var reports: [Report] = [] { | ||
didSet { | ||
tableView.reloadData() | ||
} | ||
} | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
tableView.rowHeight = 55 | ||
} | ||
|
||
override func viewDidAppear(_ animated: Bool) { | ||
super.viewDidAppear(animated) | ||
|
||
} | ||
|
||
// MARK: - Table view data source | ||
|
||
override func numberOfSections(in tableView: UITableView) -> Int { | ||
return 1 | ||
} | ||
|
||
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | ||
return reports.count | ||
} | ||
|
||
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | ||
let identifier = String(describing: RegionCell.self) | ||
let cell = tableView.dequeueReusableCell(withIdentifier: identifier, for: indexPath) as! RegionCell | ||
|
||
let report = reports[indexPath.row] | ||
cell.report = report | ||
|
||
return cell | ||
} | ||
} | ||
|
||
class RegionCell: UITableViewCell { | ||
var report: Report? { | ||
didSet { | ||
labelName.text = report?.region.name | ||
labelStats.text = report?.stat.confirmedCountString | ||
} | ||
} | ||
|
||
@IBOutlet var labelName: UILabel! | ||
@IBOutlet var labelStats: UILabel! | ||
|
||
override func awakeFromNib() { | ||
super.awakeFromNib() | ||
|
||
backgroundColor = .clear | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters