Created
October 8, 2021 14:55
-
-
Save chriseidhof/204fec7bc24b69236166a28378a33f92 to your computer and use it in GitHub Desktop.
ZStack
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct ContentView: View { | |
@State var cond = false | |
var body: some View { | |
ZStack { | |
Color.blue | |
Test(cond: cond).onTapGesture { | |
withAnimation(.easeInOut(duration: 2)) { | |
cond.toggle() | |
} | |
} | |
} | |
} | |
} | |
struct Test: View { | |
var cond: Bool | |
var body: some View { | |
if cond { | |
Text("One") | |
} else { | |
Text("Two") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment