NSAttributedString click event in UILabel using swift
Suppose I have an AttributedString : "Already have an account? Sign in!". I am placing this String in UILabel. Now when a user clicks on "Sign in!", current viewController should go to another viewController or some function should be called while clicking on sign in. Any code or suggestion should be fine. There's no need to use a separate gesture recognizer as some of the answers state. Instead, you can use attributed text in combination with the UITextViewDelegate 's textView:shouldInteractWithURL:inRange:interaction: method to achieve this, ex: class ViewController: UIViewController,