Skip to content

Instantly share code, notes, and snippets.

@lammertw
Created April 3, 2021 16:38
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 lammertw/8ea9c1fc9fd3432ea5f7e020c2b0952e to your computer and use it in GitHub Desktop.
Save lammertw/8ea9c1fc9fd3432ea5f7e020c2b0952e to your computer and use it in GitHub Desktop.
struct ContentView: View {
@EnvironmentObject var counter: ObservableCounter
var body: some View {
VStack {
Text("Current count: \(counter.count)")
Button("Increment", action: { counter.increment() })
}
.padding()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment