Skip to content

Instantly share code, notes, and snippets.

@wizard1066
Created October 5, 2020 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wizard1066/e23973cc955b8e210815af1ac6eb2108 to your computer and use it in GitHub Desktop.
Save wizard1066/e23973cc955b8e210815af1ac6eb2108 to your computer and use it in GitHub Desktop.
variable1.swift
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