Can anyone give me a little guidance with this code? thank you
Short answer. Don't put the
Text(...) inside the
action: closure. I suggest you put them elsewhere inside the
The reason you get a warning is that
action: is a normal Swift closure, and initializing a
Text value has no effect since you're not assigning it elsewhere. The closure for the
VStack and the second closure of
Button are special
@ViewBuilder closures in which the result of every statement is collected as views to be shown inside the parent view. That's why they behave differently.
Thank you very much, I will work on restructuring it.