Messagekit: Pass indexPath to MessageCellDelegate methods

Created on 24 Sep 2017  路  2Comments  路  Source: MessageKit/MessageKit

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.

question

Most helpful comment

@Jeyhey The goal was to have you use UICollectionView's indexPath(for:UICollectionViewCell) method:

https://developer.apple.com/documentation/uikit/uicollectionview/1618094-indexpath

All 2 comments

@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 : ).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

adri4silva picture adri4silva  路  4Comments

ChandraPrakashJangid picture ChandraPrakashJangid  路  3Comments

pawankmrai picture pawankmrai  路  3Comments

mlequeux picture mlequeux  路  3Comments

ahmedwasil picture ahmedwasil  路  3Comments