Title: Swift - required method not implemented: -[JSQMessagesViewController collectionView
Tags: ios;swift;swift3;jsqmessagesviewcontroller
Question: 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!) -&gt; JSQMessageData! {
    let data = self.messages[indexPath.item]
    return data
  }


  // DATA SOURCE 2
  override func collectionView(_ collectionView: UICollectionView,
                               numberOfItemsInSection section: Int) -&gt; 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!


Here is the accepted answer: Change

```func collectionView(collectionView: JSQMessagesCollectionView
```

to

```func collectionView(_ collectionView: JSQMessagesCollectionView
```



{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2017:00:02/21/17', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<ios><swift><swift3><jsqmessagesviewcontroller>', 'Title': 'Swift - required method not implemented: -[JSQMessagesViewController collectionView', 'ViewCount': 350, 'id': 42372640, 'user_AboutMe': '<p>French IoT Lover.</p>\n', 'user_AccountId': 4389009.0, 'user_DisplayName': 'Quentin Del', 'user_Reputation': 1188.0, 'user_Views': 127.0, 'user_id': 3578105.0}}