When a cell is pressed, it is handy to know which one. One way to achieve this, is to pass the indexPath of the MessageCollectionViewCell to the MessageCellDelegate methods (didTapMessage ...). Then in the controller implementation, one could look up the message in the message list.
It looks like, all is needed is to save the indexPath in MessageCollectionViewCell.configure as an instance variable and then to pass it to the methods.
@Jeyhey The goal was to have you use UICollectionView's indexPath(for:UICollectionViewCell) method:
https://developer.apple.com/documentation/uikit/uicollectionview/1618094-indexpath
Thank you! That should have been obvious : ).
Most helpful comment
@Jeyhey The goal was to have you use
UICollectionView'sindexPath(for:UICollectionViewCell)method:https://developer.apple.com/documentation/uikit/uicollectionview/1618094-indexpath