You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey Steven, I'm running into trouble with this. There are two types of possible strings this could be applied to:
One where the attributed is applied across the whole string as in NSAttributedString("Test").bolded
and another where there are multiple attributes of the same type across the string NSAttributedString("Red").colored(with: UIColor.red) + NSAttributedString("Blue").colored(with: UIColor.blue)
The problem with the second type is that the returned dictionary could only contain one color because both portions have the same NSAtributedStringKey. Returning an Array<(NSAttributedStringKey, Any, NSRange)> would be better for this case.
If this extension is meant to work on homogenous strings, the solution is easy. Let me know what you think.
Hey @nathanbacon!
I was only thinking of homogenous Strings so it is indeed an easy extension. If you think you have a solution for strings with multiple attributes under a single key, I’d look at that too
Add an extension to get all attributes on an NSAttributedString:
The text was updated successfully, but these errors were encountered: