I would like to style each link differently within either a UITextView or UILabel. I am currently using UITextViews with links but I want URLs to appear purple and usernames to appear black. I've also looked into TTTAttributedLabel but cannot seem to find out how to accomplish this.
textView.linkTextAttributes = [NSForegroundColorAttributeName: UIColor.orange]
attributedString.setAttributes([NSLinkAttributeName: url, range: range)
attributedString.addAttributes([NSForegroundColorAttributeName: UIColor.purple], range: range)
In the example above, which is what I have tried, the link will be orange, not purple. If I do not set linkTextAttributes, links will be blue. How do I override linkTextAttributes with different attributes per link?