Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
I need to be able to show a different view depending on IF statements but I am unable to figure it out:
Example:
if content == value1 { // go to view1 } if content == value2 { // go to view2 }
==
=
You can use if/else, like this:
import SwiftUI struct Test: View { @State private var something: Bool = false var body: some View { ZStack { if something { View1() } else { View2() } } } }
Add a comment
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
==. You use=to set a variable's value.