I am migrating an iOS app to Swift 3 and I keep having this error message on my ChatViewController.
2017-02-21 16:40:40.599 Jaco[52613:2864859] *** Assertion failure in -[Jaco.ChatViewController collectionView:messageDataForItemAtIndexPath:], /Users/Royal/dev/jab/ios/Pods/JSQMessagesViewController/JSQMessagesViewController/Controllers/JSQMessagesViewController.m:491
2017-02-21 16:40:40.609 Jaco[52613:2864859] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'ERROR: required method not implemented: -[JSQMessagesViewController collectionView:messageDataForItemAtIndexPath:]'
Here is part of my code
// DATA SOURCE 1
func collectionView(collectionView: JSQMessagesCollectionView!,
messageDataForItemAtIndexPath indexPath: NSIndexPath!) -> JSQMessageData! {
let data = self.messages[indexPath.item]
return data
}
// DATA SOURCE 2
override func collectionView(_ collectionView: UICollectionView,
numberOfItemsInSection section: Int) -> Int {
return messages.count
}
I tried adding "override" but the error message is still there.
Any ideas how to fix this? Thanks for your help!
Change
func collectionView(collectionView: JSQMessagesCollectionView
to
func collectionView(_ collectionView: JSQMessagesCollectionView