I'm implementing a simple chat screen using MessageKit library. As you can see in the first screenshot, everything sounds normal, but what I am asked to do is to align all threads to the left (second screenshot). I tried to find a way to change the threads alignment, but I couldn't. I appreciate if anyone can help me to find the approach.
Here is some part of my code:
extension ConversationDataSource: MessagesDisplayDelegate {
// MARK: - MessagesDisplayDelegate implementation
func messageStyle(for message: MessageType, at indexPath: IndexPath,
in messagesCollectionView: MessagesCollectionView) -> MessageStyle {
return .bubbleTail(isFromCurrentSender(message: message) ? .topRight : .topLeft, .curved)
}
func backgroundColor(for message: MessageType, at indexPath: IndexPath, in messagesCollectionView: MessagesCollectionView) -> UIColor {
return isFromCurrentSender(message: message) ? .aeroBlue : .white
}
func textColor(for message: MessageType, at indexPath: IndexPath, in messagesCollectionView: MessagesCollectionView) -> UIColor {
return .black
}
func enabledDetectors(for message: MessageType, at indexPath: IndexPath,
in messagesCollectionView: MessagesCollectionView) -> [DetectorType] {
return [.url, .address, .phoneNumber, .date]
}
func detectorAttributes(for detector: DetectorType, and message: MessageType,
at indexPath: IndexPath) -> [NSAttributedString.Key: Any] {
// Project doesn't build with Xcode 10 without implementing this explicitly
return [NSAttributedString.Key.foregroundColor: UIColor.darkText,
NSAttributedString.Key.underlineStyle: NSUnderlineStyle.single.rawValue,
NSAttributedString.Key.underlineColor: UIColor.darkText]
}
}
P.S: Please don't mind the design, the alignment is the issue for now