AttributedText
AttributedText copied to clipboard
Added access to linkTextAttributes
Description
A Pull Request to implement a solution for issue https://github.com/gonzalezreal/AttributedText/issues/21.
Created linkTextAttributes environment value. Added linkTextAttributes view modifier. Set the linkTextAttributes in iOS, macOS, and tvOS based on the context environment.
Implementation
Added linkTextAttributes as an internal property of EnvironmentValues. This limits access to linkTextAttributes to just the AttributedText package. In AttributedTextImpl.updateUIView, if linkTextAttributes has been set, then set the underlying TextView's linkTextAttributes property.
Examples
There are two ways of setting the linkTextAttributes.
- Setting with a value
AttributedText(…)
.linkTextAttributes([.foregroundColor: UIColor.black])
- Setting with a closure
AttributedText(…)
.linkTextAttributes {
[.foregroundColor: UIColor.black]
}