Unverified Commit d9192998 authored by Zach Knox's avatar Zach Knox
Browse files

it does compile. It does not yet work offline. But downloads are in a separate...

it does compile. It does not yet work offline. But downloads are in a separate function now, so that's good?
parent 9ef2af15
......@@ -181,7 +181,7 @@ class FacilitiesListViewController: UIViewController, UICollectionViewDelegate,
else {
facilitiesArray = facilitiesFromDefaults!
}
LocationsList.reloadData()
}
......@@ -206,15 +206,20 @@ class FacilitiesListViewController: UIViewController, UICollectionViewDelegate,
func refresh(_ sender: Any) {
refreshControl.beginRefreshing()
SRCTNetworkController.performDownload { (facilities) in
self.facilitiesArray = List(facilities)
SRCTNetworkController.performDownload { (facilities) in
self.facilitiesArray = facilities
DispatchQueue.main.async {
let defaults = UserDefaults.standard
defaults.set(List(facilities), forKey: "FacilitiesList")
self.LocationsList.reloadData()
//defaults.set(facilities, forKey: "FacilitiesList")
let date = Date()
defaults.set(date, forKey: "lastUpdatedList")
self.LocationsList.reloadData()
self.LastUpdatedLabel.title = "Updated: " + self.shortDateFormat(date)
}
}
LocationsList.reloadData()
refreshControl.endRefreshing()
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment