title: User Specific Avatar in JSQMessagesViewController with SDWebImage
body: <p>As the title would suggest im using JSQMessagesViewController.  Id like each user to have their own Avatar [UIImage] ill be getting this from a URL in FirebaseDatabase and extracting it via. SDWebImage.  I am able to get this inside;</p>
  
  <pre><code>override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -&gt; UICollectionViewCell {
      let cell = super.collectionView(collectionView, cellForItemAt: indexPath) as! JSQMessagesCollectionViewCell
  
      let message = messages[indexPath.item]
  
      if let messageID = message.senderId {
          rootRef.child("users").child(messageID).observe(.value, with: { (snapshot) in
  
              if let profileURL = (snapshot.value as AnyObject!)!["profileURL"] as! String! {
                  let profileNSURL: NSURL = NSURL(string: profileURL)!
                  cell.avatarImageView.sd_setImage(with: profileNSURL as URL)
              }
          })
      }
              return cell
  }
  </code></pre>
  
  <p>However, every time you send a message and the table is reloaded the images disappear then reappear as I'm assuming it is going through all the index paths again.</p>
  
  <p>There is this below method for handling the dataSource of the Avatars;</p>
  
  <pre><code>override func collectionView(_ collectionView: JSQMessagesCollectionView!, avatarImageDataForItemAt indexPath: IndexPath!) -&gt; JSQMessageAvatarImageDataSource! {
   return ???????????????????????????????????????
  }
  </code></pre>
  
  <p>but cant seem to organise the same logic as in the cellForItemAt? can anyone assist?... Many thanks.</p>
  
  <p>UPDATE: - ******************************************************************</p>
  
  <pre><code>override func collectionView(_ collectionView: JSQMessagesCollectionView!, avatarImageDataForItemAt indexPath: IndexPath!) -&gt; JSQMessageAvatarImageDataSource! {
  
      let placeHolderImage = UIImage(named: "Circled User Male Filled-25")
      let avatarImage = JSQMessagesAvatarImage(avatarImage: nil, highlightedImage: nil, placeholderImage: placeHolderImage)
  
      let message = messages[indexPath.item]
  
      if let messageID = message.senderId {
  
          rootRef.child("users").child(messageID).observe(.value, with: { (snapshot) in
  
              if let profileURL = (snapshot.value as AnyObject!)!["profileURL"] as! String! {
  
                  let profileNSURL: NSURL = NSURL(string: profileURL)!
  
                  // download avatar image here somehow!?
                  let manager: SDWebImageManager = SDWebImageManager.shared()
                  manager.downloadImage(with: profileNSURL as URL!, options: [], progress: { (receivedSize: Int, actualSize: Int) in
                      print(receivedSize, actualSize)
                  }, completed: { (image, error, cached, finished, url) in
                      avatarImage!.avatarImage = image
                  })
              }
          })
      }
  
      return avatarImage
  }
  </code></pre>
  
  <p>No errors with this and its printing out the image sizes. however the image is not changing from the placeholder image!...</p>