I'm willing to render a rich text using SwiftUI, and I'm able to achieve almost all I need with the Text concatenation approach, like:
Text("Test ").foregroundColor(.red) + Text("test").fontWeight(.black)
But, I'm lacking a way to set background color to sub-strings of the text, since the .background() modifier returns a View instead of a Text.
Is there a way or a workaround to set background color to sub-strings within a block of text?
Text("Test ").foregroundColor(.red) + Text("test").fontWeight(.black)
But, I'm lacking a way to set background color to sub-strings of the text, since the .background() modifier returns a View instead of a Text.
Is there a way or a workaround to set background color to sub-strings within a block of text?