Created
November 4, 2023 21:59
-
-
Save daltonclaybrook/4bcd8f6cc1e12f0758f013ebd3dcc81e to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
struct ContentView: View { | |
@State private var leftCounter = 1 | |
@State private var rightCounter = 1 | |
var body: some View { | |
VStack(spacing: 10) { | |
HStack { | |
Text("\(leftCounter)") | |
.font(.system(size: 26, weight: .medium)) | |
.frame(maxWidth: .infinity) | |
RoundedRectangle(cornerRadius: 6) | |
.fill(.red) | |
.aspectRatio(1, contentMode: .fit) | |
.overlay { | |
Text("D6") | |
.font(.title2) | |
.fontWeight(.heavy) | |
} | |
Text("\(rightCounter)") | |
.font(.system(size: 26, weight: .medium)) | |
.frame(maxWidth: .infinity) | |
} | |
.frame(maxHeight: 50) | |
Button("Increment") { | |
rightCounter += 1 | |
} | |
} | |
} | |
} | |
#Preview { | |
ContentView() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment