Replies: 1 comment 2 replies
-
attributedString.foregroundColor = .red
attributedString.backgroundColor = .yellow unfortunately these are from SwiftUI attributes scope, that is different than foundation, UIKit and AppKit scope. Identifiers are String based. that is, it create different attribute indentifiers, because SwiftUI doesn't like anyone
the unfortunate approach is var attributedString = AttributedString("lalamido")
attributedString.uiKit.foregroundColor = .red
attributedString.uiKit.backgroundColor = .yellow I wish there was a converter for the common attributes. I just hate it. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Swift 6.0
Xcode 16.0
Using more complex AttributedString with SwiftUI doesn't work at all.
Instead of
text: AttributedString = ""
it'll be nice to have more complex constructions workOtherwise I don't know why you decided to use AttributedString without supporting the rest of attributes
P.S.
I saw an interface for UIKIt and it's more than enough. There is no equivalent for the SwiftUI interface
Beta Was this translation helpful? Give feedback.
All reactions