Last active
January 29, 2020 04:39
-
-
Save mimthath4/29f110d08448e3f75b8d32d58ee284f7 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
import UIKit | |
class PostsViewController: MITableViewController { | |
init(posts: [Post]) { | |
super.init(style: .plain) | |
sections.append(SectionItem(id: "Post", header: nil, items: posts)) | |
} | |
required init?(coder: NSCoder) { | |
fatalError("init(coder:) has not been implemented") | |
} | |
override func registerCells() { | |
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "postCell") | |
} | |
} | |
extension Post: RowItem { | |
func getCell(at indexPath: IndexPath, of tableView: UITableView) -> UITableViewCell { | |
let cell = tableView.dequeueReusableCell(withIdentifier: "postCell", for: indexPath) | |
cell.textLabel?.text = self.title | |
return cell | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment