I want to open two urls which are in an UILabel.
So far I managed to highlight the keywords in the Label as url with NSMutableAttributedString but I am not able to click on it / open it. I know it's kinda easy if I just use an UITextView but I want to use an UILabel.
let lastLabel: UILabel = {
let label = UILabel()
let attributedString = NSMutableAttributedString(string: "If you click on register, you accept the privacy policy and the terms and conditions.")
return label
}()
...
let termsUrl = URL(string: *the first url*)!
let privacyUrl = URL(string: *the second url*)!
attributedString.setAttributes([.link: termsUrl], range: NSMakeRange(41, 14))
attributedString.setAttributes([.link: privacyUrl], range: NSMakeRange(64, 20))
lastLabel.attributedText = attributedString
The words "privacy policy" and "terms and conditions" are blue and underlined, but I cant click/open it what I would expect to be possible.