Shaik MD Ashiq Shaik MD Ashiq - 1 year ago 144
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.

Answer Source

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

textView.dataDetectorTypes = UIDataDetectorTypeLink; 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download