Created
December 3, 2018 08:45
-
-
Save rockname/0dc9d9c177cdbf8cf054fc64ca31116b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | |
| switch indexPath.section { | |
| case 0: | |
| return tableView.dequeueReusableCell(withIdentifier: "ProfileTableViewCell") as! ProfileTableViewCell | |
| case 1: | |
| let cell = tableView.dequeueReusableCell(withIdentifier: "TaskTableViewCell") as! TaskTableViewCell | |
| let personalTask = tasks.filter { $0.category == .personal }[indexPath.row] | |
| cell.configure(with: personalTask) | |
| return cell | |
| case 2: | |
| let cell = tableView.dequeueReusableCell(withIdentifier: "TaskTableViewCell") as! TaskTableViewCell | |
| let shoppingTask = tasks.filter { $0.category == .shopping }[indexPath.row] | |
| cell.configure(with: shoppingTask) | |
| return cell | |
| case 3: | |
| let cell = tableView.dequeueReusableCell(withIdentifier: "TaskTableViewCell") as! TaskTableViewCell | |
| let workTask = tasks.filter { $0.category == .work }[indexPath.row] | |
| cell.configure(with: workTask) | |
| return cell | |
| default: | |
| fatalError() | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment