I am trying to combine multiple Text views that have different modifiers. For example:
Text("This is") +
Text("important")
.overlay(
Text("overlayed text")
.padding(.all, 10)
) +
Text("text")
The middle Text view returns some View since I applied the overlay modifier, but it cannot be combined with the other views since they are just Text views. I tried some methods, like I wrapped the Text view inside AnyView to erase its type, but + operator does not work with AnyView. I also tried to put them in HStack, but that messes it up if I have longer text strings. What other options can I use please, or are there any work-arounds?