title: JSQMessages TextForMessageBubbleTopLabel, swift
body: <p>I did some research about how to display sender name above the message bubbles on JSQMessage, but nothing is showing above the bubbles. Below is my code: the messages work fine, it is just the display name. Suggestions?</p>
  
  <pre><code>func collectionView(collectionView: JSQMessagesCollectionView!, attributedTextForMessageBubbleTopLabelAtIndexPath indexPath: NSIndexPath!) -&gt; NSAttributedString! {
      let message = messages[indexPath.item];
  
      // Sent by me, skip
      if message.senderId == senderId {
          return nil;
      }
  
      // Same as previous sender, skip
      if indexPath.item &gt; 0 {
          let previousMessage = messages[indexPath.item - 1];
          if previousMessage.senderId == message.senderId {
              return nil;
          }
      }
  
      return NSAttributedString(string:message.senderId)
  }
  
  func collectionView(collectionView: JSQMessagesCollectionView!, layout collectionViewLayout: JSQMessagesCollectionViewFlowLayout!, heightForMessageBubbleTopLabelAtIndexPath indexPath: NSIndexPath!) -&gt; CGFloat {
      let message = messages[indexPath.item]
  
      // Sent by me, skip
      if message.senderId == senderId {
          return CGFloat(0.0);
      }
  
      // Same as previous sender, skip
      if indexPath.item &gt; 0 {
          let previousMessage = messages[indexPath.item - 1];
          if previousMessage.senderId == message.senderId {
              return CGFloat(0.0);
          }
      }
  
      return kJSQMessagesCollectionViewCellLabelHeightDefault
  }
  </code></pre>