Created
April 14, 2019 08:41
-
-
Save JulienKode/890a7f774bea73335dde27824c1c0b23 to your computer and use it in GitHub Desktop.
Change detectors attributes based on DetectorType for MessageKit
This file contains hidden or 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
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