Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mischa-hildebrand/151fc5ba6b17704fc7467c026c56f909 to your computer and use it in GitHub Desktop.
Save mischa-hildebrand/151fc5ba6b17704fc7467c026c56f909 to your computer and use it in GitHub Desktop.
MessagingViewController
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