include diehammer plan docs
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
//
|
||||
// IncrementDie.swift
|
||||
// Bunch O' Dice
|
||||
//
|
||||
// Created by Rory Martin Hinnen on 6/7/22.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct AddToPool: View {
|
||||
@EnvironmentObject var current: Roll
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
Spacer()
|
||||
Text(String(current.total) + " 🎲")
|
||||
.font(.system(size: 40))
|
||||
.padding(15)
|
||||
HStack {
|
||||
ForEach(Array(stride(from: 2, through: 0, by: -1)), id: \.self) { place in
|
||||
VStack{
|
||||
Text("▲")
|
||||
.gesture(TapGesture().onEnded({
|
||||
current.incrementDigits(place: place)
|
||||
}))
|
||||
Text(String(current.totalDigits[place]))
|
||||
.padding(4)
|
||||
.border(.black, width: 1.0)
|
||||
Text("▼")
|
||||
.gesture(TapGesture().onEnded({
|
||||
current.decrementDigits(place: place)
|
||||
}))
|
||||
}
|
||||
}
|
||||
}
|
||||
.font(.system(size: 45))
|
||||
.padding(10)
|
||||
Button("Clear", action: {current.total = 0})
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct IncrementDie_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
AddToPool()
|
||||
.environmentObject(Roll())
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user