DO NOT DO THIS.
Every so often this pops up and it's a time bomb just waiting to cause unintended side effects.
Why? Because SwiftUI considers the view inside of the if to be different from the view inside of the else. It's positional identity. As such, having your condition change can cause every descendent view in the view hierarchy to lose state when the old view hierarchy is destroyed and the new view hierarchy is created.
For an in-depth explanation see the following article (not mine) on objc.io.
https://www.objc.io/blog/2021/08/24/conditional-view-modifiers/