Is it possible to have different .link colors in NSAttributedString?
for example i have
let style : [NSAttributedString.Key: Any] = [
.link: "https://www.test.com",
NSAttributedString.Key.foregroundColor: UIColor.red,
NSAttributedString.Key.strikethroughStyle: NSUnderlineStyle.single.rawValue,
NSAttributedString.Key.strikethroughColor: UIColor.red
]
let style2 : [NSAttributedString.Key: Any] = [
.link: "https://www.anotherTest.com",
NSAttributedString.Key.foregroundColor: UIColor.green,
NSAttributedString.Key.strikethroughStyle: NSUnderlineStyle.single.rawValue,
NSAttributedString.Key.strikethroughColor: UIColor.green
]
and applied in a range
I tried
view.linkTextAttributes = style
but there is no range option and it is applied to all .links
i also tried to overwrite foregroundColor
textStorage.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.red, range: range)
Any ideas?
Thanks