I am trying to link all tags in a string to their respective href's so it can be tapped and opened in browser.
This is what I have,
<p>This is a simple text with some embedded <a href="http://example.com/link/to/some/page?param1=77¶m2=22">links</a>.
This is a <a href="https://exmp.le/sample-page/?uu=1">different link</a>.
How do I process this text and link all anchor tags to their respective href?
pseudo code of what I want to achieve:
let finalContentLabel = TTTAttributedLabel(frame: CGRect.zero)
for (linkText, linkHref) in paragraph.anchorTags() {
let range:NSRange = (finalContentLabel.text as! NSString).range(of: linkText)
finalContentLabel.addLink(to: URL(string: linkHref), with: range)
}
I have figured out everything but paragraph.anchorTags()
bit.