Skip to content

Instantly share code, notes, and snippets.

@raushankrjha
Created October 19, 2019 21:34
Show Gist options
  • Save raushankrjha/a227a30cee7f85fc1762e995b4623777 to your computer and use it in GitHub Desktop.
Save raushankrjha/a227a30cee7f85fc1762e995b4623777 to your computer and use it in GitHub Desktop.
import SwiftUI
struct ContentView: View {
@State var count: Int = 0
var body: some View {
VStack(spacing:50.0)
{
Text("Number \(count)")
.fontWeight(.bold)
.font(.title)
.padding();
Button(action: {
//Perform Action
self.count=self.count+1
})
{
//Design Button
Text("Increase Counter")
.fontWeight(.bold)
.font(.title)
.padding()
.background(Color.red)
.cornerRadius(30)
.foregroundColor(.white)
.padding(10)
}
}
}
}
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