Skip to content

Instantly share code, notes, and snippets.

@mchirico
Created October 16, 2020 17:03
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 mchirico/f13b9275a97bb797ecbde703a7e619c6 to your computer and use it in GitHub Desktop.
Save mchirico/f13b9275a97bb797ecbde703a7e619c6 to your computer and use it in GitHub Desktop.
import SwiftUI
struct ContentView: View {
@State var count: Int = 0
@State var txt: String = "Label:"
var body: some View {
VStack {
Label(self.txt, systemImage: /*@START_MENU_TOKEN@*/"42.circle"/*@END_MENU_TOKEN@*/)
HStack {
Button(action: {
self.count = self.count + 1
self.txt = "count: \(self.count)"
print("count: \(self.count)")
}
) {
Text("button")
.fontWeight(.heavy)
}
Text("Hello, world!")
.font(.headline)
.foregroundColor(Color.blue)
.multilineTextAlignment(.center)
.padding()
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment