This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // MARK: Multiple Tappable Links in a UILabel | |
| extension UITapGestureRecognizer { | |
| func didTapAttributedTextInLabel(label: UILabel, inRange targetRange: NSRange) -> Bool { | |
| // Create instances of NSLayoutManager, NSTextContainer and NSTextStorage | |
| let layoutManager = NSLayoutManager() | |
| let textContainer = NSTextContainer(size: CGSize.zero) | |
| let textStorage = NSTextStorage(attributedString: label.attributedText!) | |
| // Configure layoutManager and textStorage |