I'm seeing something odd inside of UITextView. The UITextView is able to detect my address, but I'm not able to style the text, even though I'm able to style phone numbers & web links.
See the code below (I've tried tintColor & linkTextAttributes - both seem to apply to things other than the Address link)
let t = "One Infinite Loop Cupertino, CA 95014 some other text yeah www.google.com 123-555-1212 One Infinite Loop Cupertino, CA 95014"
let a = NSAttributedString(string: t)
self.textView.attributedText = a
self.textView.isEditable = false
self.textView.textColor = .green
self.textView.tintColor = .blue
self.textView.dataDetectorTypes = [.link, .address, .phoneNumber]
let linkAttributes: [String : Any] = [
NSAttributedStringKey.foregroundColor.rawValue: UIColor.red,
NSAttributedStringKey.underlineColor.rawValue: UIColor.orange,
NSAttributedStringKey.underlineStyle.rawValue: NSUnderlineStyle.styleSingle.rawValue]
self.textView.linkTextAttributes = linkAttributes
As you can see, the Address is underlined & clickable (clicking takes me to maps), but the red color isn't applied to it, even though other things detected by the data detector are picked up.
Thoughts?
