Skip to content

Instantly share code, notes, and snippets.

@JulienKode
Created April 14, 2019 08:22
Show Gist options
  • Save JulienKode/0e999220198c8076b2743052ece5beb2 to your computer and use it in GitHub Desktop.
Save JulienKode/0e999220198c8076b2743052ece5beb2 to your computer and use it in GitHub Desktop.
Enable custom detectors with MessageKit
extension MyAwesomeViewController: MessagesDisplayDelegate {
// ...
func enabledDetectors(for message: MessageType, at indexPath: IndexPath, in messagesCollectionView: MessagesCollectionView) -> [DetectorType] {
return [.hashtag, .custom(try! NSRegularExpression(pattern: "@[a-zA-Z0-9]{4,}", options: [])) ]
}
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment