Shaik MD Ashiq Shaik MD Ashiq - 5 months ago 68
Swift Question

How to detect if there is a Link in UILabel text and make it clickable - Swift

I am using a

to contain some text. This text may sometimes contain some links like or or even How do I detect these links and make the text clickable to open in a browser. Please advice. Thanks in advance.


You can use a UITextView instead and set detection for links:

textView.dataDetectorTypes = UIDataDetectorTypeLink;