2 // NewsViewController.swift
5 // Created by Pawel Dabrowski on 15/09/2018.
6 // Copyright © 2018 Fundacja Nowoczesna Polska. All rights reserved.
11 class NewsViewController: ListViewController {
13 static func instance(dataSource: [Any]?) -> NewsViewController {
14 let controller = NewsViewController.instance()
15 controller.dataSource = dataSource ?? [BookModel]()
16 controller.listViewControllerType = .news
20 override func setupTableView() {
21 super.setupTableView()
22 tableView.registerNib(name: "NewsTableViewCell")
23 tableView.rowHeight = 97
26 override func getLastObjectAfterParameter() -> String? {
28 if let last = dataSource.last as? BookModel {
29 return last.full_sort_key
34 override func getTableViewCell(tableView: UITableView, indexPath: IndexPath) -> UITableViewCell {
35 let cell = tableView.dequeueReusableCell(withIdentifier: "NewsTableViewCell", for: indexPath) as! NewsTableViewCell
36 cell.setup(newsModel: dataSource[indexPath.row] as! NewsModel)
40 override func didSelectRow(row: Int) {
41 if dataSource.count > row {
42 navigationController?.pushViewController(NewsDetailsViewController.instance(newsModel: dataSource[row] as! NewsModel) , animated: true)