I use this code:
var textView = UITextView(x: 10, y: 10, width: CardWidth - 20, height: placeholderHeight) //This is my custom initializer
textView.text = "dsfadsaf www.google.com"
textView.selectable = true
textView.dataDetectorTypes = UIDataDetectorTypes.Link
textView.delegate = self
addSubview(textView)
The problem is the link needs long tap gesture to open. I want it to open with a single tap, just like in the Facebook app.
The example below only works on iOS 8+
Tap recognizer:
Callback:
Swift 3 and no force unwraps: