Skip to content

Instantly share code, notes, and snippets.

@JulienKode
Created April 14, 2019 08:41
Show Gist options
  • Save JulienKode/890a7f774bea73335dde27824c1c0b23 to your computer and use it in GitHub Desktop.
Save JulienKode/890a7f774bea73335dde27824c1c0b23 to your computer and use it in GitHub Desktop.
Change detectors attributes based on DetectorType for MessageKit
extension MyAwesomeViewController: MessagesDisplayDelegate {
// ...
func detectorAttributes(for detector: DetectorType, and message: MessageType, at indexPath: IndexPath) -> [NSAttributedString.Key: Any] {
switch detector {
case .hashtag:
return [.foregroundColor: UIColor.white]
case .custom:
return [.foregroundColor: UIColor.black]
default: return MessageLabel.defaultAttributes
}
}
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment