Skip to content

Instantly share code, notes, and snippets.

@wizard1066
Created October 5, 2020 16:15
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/48924e53bf0cc83f8283dffdf8187565 to your computer and use it in GitHub Desktop.
Save wizard1066/48924e53bf0cc83f8283dffdf8187565 to your computer and use it in GitHub Desktop.
variable4.swift
struct ContentView: View {
@AppStorage("greeting") var greeting: String = "X"
var body: some View {
SwiftUIViewE()
.onTapGesture {
self.greeting = "Hello, World!"
}
}
}
struct SwiftUIViewE: View {
@AppStorage("greeting") var greeting: String = "Y"
var body: some View {
Text(self.greeting)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment