Post

Replies

Boosts

Views

Activity

Comment on Why can't SwiftUI state be changed in the middle of view updates?
Thirdly, I'm not sure what you mean when you say that @ViewBuilder is "not valid SwiftUI". It's a public piece of the API which has a very specific effect. My understanding is that my usage of it here is exactly the type of situation where explicitly spelling out @ViewBuilder (instead of allowing it to be inferred on the body property of a View) is recommended. What it allows for is producing views using language constructs like if and switch.
2w
Comment on Why can't SwiftUI state be changed in the middle of view updates?
I don't think these pieces of advice are correct. Firstly, I'm aware of which aspect of my code triggers the warning. My question is about why the framework developers chose to flag recursive view updates as a problem, when it seems to me that as long as the recursion is not infinite it would be perfectly coherent code, and also the code currently produces exactly the desired behavior (except for the presence of the warning).
2w