Created
July 6, 2018 04:29
-
-
Save laevandus/5b865964e4427aaeaa9980d0da821e4a to your computer and use it in GitHub Desktop.
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
private func fetchPlanets() { | |
do { | |
try planetsController.performFetch() | |
tableView.reloadData() | |
} | |
catch { | |
NSLog("Fetching failed with error \(error as NSError).") | |
} | |
} | |
override func numberOfSections(in tableView: UITableView) -> Int { | |
return 1 | |
} | |
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | |
return planetsController.sections?[0].numberOfObjects ?? 0 | |
} | |
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | |
let cell = tableView.dequeueReusableCell(withIdentifier: "PlanetCellIdentifier", for: indexPath) | |
cell.accessoryType = .disclosureIndicator | |
cell.textLabel?.text = planetsController.object(at: indexPath).name | |
return cell | |
} | |
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { | |
scenePresenter?.presentDetailedInfo(for: planetsController.object(at: indexPath)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment