1

i'm trying to implement slide to show timestamp into messengekit libaray

One thing I am stuck on is how to "Slide" the entire collection view to show the timestamp of each message. That said, I don't expect the algorithm for the timestamps, I already have the timestamps stored for each message. I'm only confused on the concept of sliding the collection view. I can't find anything on it. I've tried plenty of documentation. Thanks!

enter image description here

Kashif Ahmed
  • 803
  • 9
  • 20

1 Answers1

1

You can use the following to achieve this with MessageKit.

        self.showMessageTimestampOnSwipeLeft = true
    func messageTimestampLabelAttributedText(for message: MessageType, at indexPath: IndexPath) -> NSAttributedString? {
        let messageDate = message.sentDate
        let formatter = DateFormatter()
        formatter.dateFormat = "HH:mm"
        let dateString = formatter.string(from: messageDate)
        return
            NSAttributedString(string: dateString, attributes: [.font: UIFont.systemFont(ofSize: 12)])
    }