flmcl
(francis)
1
Can anyone give me a little guidance with this code? thank you
michelf
(Michel Fortin)
2
Short answer. Don't put the Text(...) inside the action: closure. I suggest you put them elsewhere inside the VStack.
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.
1 Like
flmcl
(francis)
3
Thank you very much, I will work on restructuring it.