mirror of
https://github.com/neon443/RNG_Swift.git
synced 2026-03-11 06:49:12 +00:00
initial commit
This commit is contained in:
@@ -26,21 +26,27 @@ struct DiceView: View {
|
|||||||
HStack {
|
HStack {
|
||||||
Spacer()
|
Spacer()
|
||||||
if displayDies.isEmpty {
|
if displayDies.isEmpty {
|
||||||
|
Text("Results are visualised here when you press the generate button")
|
||||||
|
.font(.subheadline)
|
||||||
|
} else if displayDies.count != Int(dies) {
|
||||||
|
Text("Press Generate")
|
||||||
|
.font(.subheadline)
|
||||||
|
} else {
|
||||||
LazyVGrid(columns: columns, spacing: 10) {
|
LazyVGrid(columns: columns, spacing: 10) {
|
||||||
|
|
||||||
ForEach(0..<displayDies.count, id: \.self) { index in
|
ForEach(0..<displayDies.count, id: \.self) { index in
|
||||||
Image(systemName: "die.face.\(index > displayDies.count ? Int.random(in: 1...6) : displayDies[index])")
|
Image(systemName: "die.face.\(index > displayDies.count ? Int.random(in: 1...6) : displayDies[index])")
|
||||||
.resizable()
|
.resizable()
|
||||||
.scaledToFit()
|
.scaledToFit()
|
||||||
.frame(width: 50, height: 50)
|
.frame(width: 50, height: 50)
|
||||||
|
if index != displayDies.count {
|
||||||
Image(systemName: multiDieMode)
|
Image(systemName: multiDieMode)
|
||||||
.resizable()
|
.resizable()
|
||||||
.scaledToFit()
|
.scaledToFit()
|
||||||
.frame(width: 25)
|
.frame(width: 10, height: 10)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}.padding()
|
}.padding()
|
||||||
} else {
|
|
||||||
Text("Results are visualised here when you press the generate button")
|
|
||||||
}
|
}
|
||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
@@ -63,7 +69,7 @@ struct DiceView: View {
|
|||||||
multiDieMode = "multiply"
|
multiDieMode = "multiply"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}.animation(.spring, value: displayDies)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user