title: Hyperlink + click like button on NSAttributedString
body: <p>I have a username variable and a message string such as "liked your post" and in order to be able to cast it as one string, I combined them in an NSMutableAttributedString. As it'll be easy, I am </p>
  
  <pre><code>let username = notification["username"].string
  let notificationBody = notification["body"].string
  
  let notificationString = NSMutableAttributedString(string: "\(username!) \(notificationBody!)")
  notificationString.addAttributes([NSForegroundColorAttributeName: UIColor.blackColor()], range: NSMakeRange(0, (username?.characters.count)!))
  cell.notificationLabel.attributedText = notificationString
  </code></pre>
  
  <p>Colouring the text is working as expected, however, I want to be able to click on the username and at the same time achieve a colour-effect of click (like click on button). Here is what I mean:</p>
  
  <p>Without click: <a href="https://i.stack.imgur.com/yU3Mj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yU3Mj.png" alt="enter image description here"></a></p>
  
  <p>on click : 
  <a href="https://i.stack.imgur.com/vBicT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vBicT.png" alt="enter image description here"></a> and segue to another VC.</p>
  
  <hr>
  
  <p>I actually achieved what I want to achieve with a primitive hack that I absolutely do not like. What I did was, first I added an extra button over username and set background-color: clear color. And it visually seems nice if the width of the username coincidentally matches the width of the button in Storyboard - cell. Otherwise, it seems buggy.</p>
  
  <p>Extra Button layer over 'username' text: <a href="https://i.stack.imgur.com/rqnb7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rqnb7.png" alt="enter image description here"></a></p>
  
  <hr>
  
  <p>What is the practical way of achieving what I want to achieve? Should I just change the width of the transparent button for each cell, according to the username character count? So if for 4-6 words, x width; if 8-10 words, y width?</p>
  
  <p>Are there any better ways than this?</p>