Created
October 14, 2018 22:48
-
-
Save mischa-hildebrand/151fc5ba6b17704fc7467c026c56f909 to your computer and use it in GitHub Desktop.
MessagingViewController
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 MessagingViewController: UIViewController { | |
@IBOutlet private var tableView: UITableView! | |
@IBOutlet private var messageTextField: UITextView! | |
/// Assigned by the conversations view controller when the segue in triggered. | |
var dataSource: MessagingDataSource? | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
tableView.dataSource = dataSource | |
dataSource?.delegate = self | |
title = dataSource?.title | |
} | |
@IBAction private func sendMessage(_ sender: UIButton) { | |
guard let message = messageTextField.text else { | |
return | |
} | |
dataSource?.send(message) | |
messageTextField.text = nil | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment