dickyj
dickyj

Reputation: 1870

TTTAttributedLabel clickable link does not work in Swift 3

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!) {
}

Upvotes: 2

Views: 2153

Answers (2)

Svitlana
Svitlana

Reputation: 3006

   extension YourViewController: TTTAttributedLabelDelegate {   
        func attributedLabel(_ label: TTTAttributedLabel!, didSelectLinkWith url: URL!) {
            UIApplication.shared.openURL(url)
        }
    }

Upvotes: 0

Juan F. Caracciolo
Juan F. Caracciolo

Reputation: 197

Did you remember to connect the delegate?

label.delegate = self

It is working for me

Upvotes: 2

Related Questions