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
I realize that type-safety for a finite number of Foundation values is part of SwiftyAttributes's appeal, but I also think this crash should be handled by the library due to the existence of NSAttributedStringKey(string:).
I haven't given too much thought into how I think this could be handled, but perhaps something like: .custom([String: Any]) is an appropriate solution for any NSAttributedStringKey values that can't be constructed via NSAttributedStringKey(rawValue:).
FWIW, this came up due to some work I'm doing with markdown rendering, where we're storing the URL for links in a custom attribute as part of the attributed string.
The text was updated successfully, but these errors were encountered:
Interesting, I've never considered custom string keys. I like the idea of a .custom attribute, although I feel like .custom(String, Any) would make more sense to ensure a one-to-one mapping of attribute to Attribute. Started working on it already!
When working with
NSAttributedStrings
that use customNSAttributedStringKey
values, SwiftyAttributes crashes whenever attributes are accessed.Here's one way to reproduce:
I realize that type-safety for a finite number of
Foundation
values is part of SwiftyAttributes's appeal, but I also think this crash should be handled by the library due to the existence ofNSAttributedStringKey(string:)
.I haven't given too much thought into how I think this could be handled, but perhaps something like:
.custom([String: Any])
is an appropriate solution for anyNSAttributedStringKey
values that can't be constructed viaNSAttributedStringKey(rawValue:)
.FWIW, this came up due to some work I'm doing with markdown rendering, where we're storing the URL for links in a custom attribute as part of the attributed string.
The text was updated successfully, but these errors were encountered: