2

I just upgraded to Swift 3. I created a TTTAttributedLabel with a clickable URL, unfortunately the delegate function does not work anymore. Anyone has similar problems?

    func attributedLabel(_ label: TTTAttributedLabel!, didSelectLinkWith url: URL!) {
}
dickyj
  • 1,830
  • 1
  • 24
  • 41

2 Answers2

2

Did you remember to connect the delegate?

label.delegate = self

It is working for me

0
   extension YourViewController: TTTAttributedLabelDelegate {   
        func attributedLabel(_ label: TTTAttributedLabel!, didSelectLinkWith url: URL!) {
            UIApplication.shared.openURL(url)
        }
    }
Svitlana
  • 2,938
  • 1
  • 29
  • 38