diff --git a/Tusker/Screens/Conversation/Conversation.storyboard b/Tusker/Screens/Conversation/Conversation.storyboard index d6871a2c..fa02c6b4 100644 --- a/Tusker/Screens/Conversation/Conversation.storyboard +++ b/Tusker/Screens/Conversation/Conversation.storyboard @@ -1,43 +1,30 @@ - + - - + - + - - + + - - - - - - - - - - - - - - - - - - - + + + + + + + - + diff --git a/Tusker/Screens/Conversation/ConversationViewController.swift b/Tusker/Screens/Conversation/ConversationViewController.swift index 8c2684b6..5250599c 100644 --- a/Tusker/Screens/Conversation/ConversationViewController.swift +++ b/Tusker/Screens/Conversation/ConversationViewController.swift @@ -9,7 +9,7 @@ import UIKit import Pachyderm -class ConversationViewController: UIViewController, UITableViewDataSource, UITableViewDelegate { +class ConversationViewController: UITableViewController { static func create(for mainStatusID: String) -> ConversationViewController { guard let conversationController = UIStoryboard(name: "Conversation", bundle: nil).instantiateInitialViewController() as? ConversationViewController else { fatalError() } @@ -17,8 +17,6 @@ class ConversationViewController: UIViewController, UITableViewDataSource, UITab return conversationController } - @IBOutlet weak var tableView: UITableView! - var mainStatusID: String! var statusIDs: [String] = [] { @@ -91,15 +89,15 @@ class ConversationViewController: UIViewController, UITableViewDataSource, UITab // MARK: - Table view data source - func numberOfSections(in tableView: UITableView) -> Int { + override func numberOfSections(in tableView: UITableView) -> Int { return 1 } - func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return statusIDs.count } - func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let statusID = statusIDs[indexPath.row] if statusID == mainStatusID { @@ -116,20 +114,20 @@ class ConversationViewController: UIViewController, UITableViewDataSource, UITab } } - func tableView(_ tableView: UITableView, willSelectRowAt indexPath: IndexPath) -> IndexPath? { + override func tableView(_ tableView: UITableView, willSelectRowAt indexPath: IndexPath) -> IndexPath? { let statusID = statusIDs[indexPath.row] return statusID == mainStatusID ? nil : indexPath } - func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool { + override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool { return tableView.cellForRow(at: indexPath) is TableViewSwipeActionProvider } - func tableView(_ tableView: UITableView, leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { + override func tableView(_ tableView: UITableView, leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { return (tableView.cellForRow(at: indexPath) as? TableViewSwipeActionProvider)?.leadingSwipeActionsConfiguration() } - func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { + override func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { return (tableView.cellForRow(at: indexPath) as? TableViewSwipeActionProvider)?.trailingSwipeActionsConfiguration() }