Files
MessageKit/Sources/MessagesDisplayDataSource.swift
T
2017-07-26 04:06:46 -05:00

25 lines
770 B
Swift

//
// MessagesDisplayDataSource.swift
// MessageKit
//
// Created by Steven on 7/26/17.
// Copyright © 2017 Hexed Bits. All rights reserved.
//
import Foundation
// I don't want this to inherit from MessagesDataSource really but I need access to isFromCurrentSender(message:) for now
public protocol MessagesDisplayDataSource: class, MessagesDataSource {
func avatarForMessage(_ message: MessageType, at indexPath: IndexPath, in collectionView: UICollectionView) -> Avatar
}
public extension MessagesDisplayDataSource {
func messageColorFor(_ message: MessageType, at indexPath: IndexPath, in collectionView: UICollectionView) -> UIColor {
return isFromCurrentSender(message: message) ? .outgoingGreen : .incomingGray
}
}