A SlackTextViewController replacement written in Swift for the iPhone X.

Installation
Just add MessageViewController
to your Podfile and install. Done!
pod 'MessageViewController'
Setup
You must subclass MessageViewController
.
```swiftimport MessageViewController
class ViewController: MessageViewController { // ...}```
Finish setup using a UIScrollView
. Remember this can also be a UITableView
or UICollectionView
.
swiftfunc viewDidLoad() { super.viewDidLoad() setup(scrollView: scrollView)}
Customizations
You can customize any part of the UI that you want!
```swift// Border between the text view and the scroll viewborderColor = .lightGray
// Change the appearance of the text view and its contentmessageView.inset = UIEdgeInsets(top: 8, left: 16, bottom: 8, right: 16)messageView.textView.placeholderText = "New message..."messageView.textView.placeholderTextColor = .lightGraymessageView.font = UIFont.systemFont(ofSize: 17)
// Setup the button using text or an iconmessageView.set(buttonTitle: "Send", for: .normal)messageView.addButton(target: self, action: #selector(onButton))messageView.buttonTint = .blue```
Autocomplete
The base view controller uses a MessageAutocompleteController
control to handle text autocompletion.
This control uses a plain UITableView
to display its autocomplete. Add a dataSource
and delegate
to display and handle interactions.
swiftlet tableView = messageAutocompleteController.tableViewtableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell")tableView.dataSource = selftableView.delegate = self
Then register for autocomplete prefixes you want to respond to and set a delegate
to handle when a prefix is found.
swiftmessageAutocompleteController.register(prefix: "@")messageAutocompleteController.delegate = self
Your delegate needs to implement just one method.
swiftfunc didFind(controller: MessageAutocompleteController, prefix: String, word: String) { // filter your data controller.show(true)}
Note: You can perform asyncronous autocomplete searches. Just be sure to call messageAutocompleteController.show()
when finished.
Acknowledgements
To restore the repository download the bundle
wget https://archive.org/download/github.com-GitHawkApp-MessageViewController_-_2018-01-30_04-57-15/GitHawkApp-MessageViewController_-_2018-01-30_04-57-15.bundle
and run:
git clone GitHawkApp-MessageViewController_-_2018-01-30_04-57-15.bundle
Source:
https://github.com/GitHawkApp/MessageViewControllerUploader:
GitHawkAppUpload date: 2018-01-30