Created
September 2, 2020 18:50
-
-
Save xavierLowmiller/378e63c22aee6a07a650fe01305e2f6e to your computer and use it in GitHub Desktop.
A simple counter app for watchOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
@main | |
struct WatchOS_CounterApp: App { | |
@AppStorage("counter") var counter = 0 | |
var body: some Scene { | |
WindowGroup { | |
VStack { | |
Text("\(counter)") | |
.font(.system(size: 72, design: .rounded)) | |
HStack { | |
Button(action: { counter = 0 }, label: { | |
Image(systemName: "xmark.bin") | |
.scaleEffect(1.5) | |
}) | |
Button(action: { counter += 1 }, label: { | |
Image(systemName: "plus") | |
.scaleEffect(1.5) | |
}) | |
} | |
.padding() | |
} | |
.foregroundColor(.white) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment