Created
October 5, 2020 15:46
-
-
Save wizard1066/e23973cc955b8e210815af1ac6eb2108 to your computer and use it in GitHub Desktop.
variable1.swift
This file contains 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
struct ContentView: View { | |
@State var greeting: String = "X" | |
var body: some View { | |
SwiftUIViewA(greeting: $greeting) | |
.onTapGesture { | |
greeting = "Hello, World!" | |
} | |
} | |
} | |
struct SwiftUIViewA: View { | |
@Binding var greeting:String | |
var body: some View { | |
Text(greeting) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment