We cannot make uilabel properties available as you want, in your case we can use TextView for such a property
my class:
import UIKit class TextViewVC: UIViewController { @IBOutlet weak var textView: UITextView! let termsAndConditionsURL = "termsandconditions" override func viewDidLoad() { super.viewDidLoad() textView.delegate = self // Do any additional setup after loading the view. let str = "I agree to below Terms & Condistions" let attributedString = NSMutableAttributedString(string: str) let foundRange = attributedString.mutableString.range(of: "Terms & Condistions") attributedString.addAttribute(.foregroundColor, value: UIColor.blue, range: foundRange) attributedString.addAttribute(.underlineStyle , value: NSUnderlineStyle.styleSingle.rawValue, range: foundRange) attributedString.addAttribute(.link, value: termsAndConditionsURL, range: foundRange) textView.attributedText = attributedString } } extension TextViewVC : UITextViewDelegate { func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange) -> Bool { if (URL.absoluteString == termsAndConditionsURL) { print("Need an action here") } else { print("No") } return false } }
My storyBoard to create a textView:

Simulator output

Console exit

iOS Geek
source share