[Swift]: Make UILable clickable in Swift 5

swift

05/06/2019


Make UILable clickable in Swift 5

Create an outlet from the UILabel

SWIFT
@IBOutlet weak var exampleLabel: UILabel!
SWIFT
override func viewDidLoad() {
// make label tappable
exampleLabel.isUserInteractionEnabled = true
let tap = UITapGestureRecognizer(target: self, action: #selector(tapFunc))
exampleLabel.addGestureRecognizer(tap)
}
@objc
func tapFinish() {
print("tapped") ///
}

WRITTEN BY

Keeping a record