title: Link in UITextView not working in Swift 4
body: <p>I'm using iOS 11 and Swift 4.</p>
  
  <p>I am trying to programmatically generate a link inside a <code>UITextView</code>.</p>
  
  <p>All the attributes work (i.e. color, size, range etc.) - but unfortunately, the link does not work. Can anybody tell me why?</p>
  
  <p>Here is my code:</p>
  
  <pre><code>@IBOutlet weak var textView: UITextView!
  
  // Setting the attributes
  let linkAttributes = [
      NSAttributedStringKey.link: URL(string: "https://www.apple.com")!,
      NSAttributedStringKey.font: UIFont(name: "Helvetica", size: 18.0)!,
      NSAttributedStringKey.foregroundColor: UIColor.blue
      ] as [NSAttributedStringKey : Any]
  
  let attributedString = NSMutableAttributedString(string: "Just click here to do stuff...")
  
  // Set the 'click here' substring to be the link
  attributedString.setAttributes(linkAttributes, range: NSMakeRange(5, 10))
  
  self.textView.delegate = self
  self.textView.attributedText = attributedString
  </code></pre>
  
  <p>Again, the link seems correct, but clicking it does not work.</p>
  
  <p>Here is the screenshot:</p>
  
  <p><a href="https://i.stack.imgur.com/43UfT.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/43UfT.jpg" alt="Screenshot of the UITextView"></a></p>