Skip to content

Instantly share code, notes, and snippets.

@daltonclaybrook
Created November 4, 2023 21:59
Show Gist options
  • Save daltonclaybrook/4bcd8f6cc1e12f0758f013ebd3dcc81e to your computer and use it in GitHub Desktop.
Save daltonclaybrook/4bcd8f6cc1e12f0758f013ebd3dcc81e to your computer and use it in GitHub Desktop.
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