Created
June 7, 2020 07:05
-
-
Save TungVuDuc2805/c6bf84b1630981255f959e938f289eb5 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
class ProfileViewModel: NSObject, UITableViewDataSource { | |
var items: [ProfileSectionControllerProtocol] = [] | |
func numberOfSections(in tableView: UITableView) -> Int { | |
return items.count | |
} | |
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | |
return items[section].rowCount | |
} | |
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | |
let sectionController = items[indexPath.section] | |
let cellController = sectionController.cells[indexPath.row] | |
return cellController.view(tableView) | |
} | |
func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { | |
return items[section].title | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment