From 450f9d1bcef8686d8a5699a1ab3a12119cb60518 Mon Sep 17 00:00:00 2001 From: neon443 <69979447+neon443@users.noreply.github.com> Date: Sun, 26 May 2024 19:58:33 +0100 Subject: [PATCH] initial commit --- DiceView.swift | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/DiceView.swift b/DiceView.swift index 0015831..a10b2e6 100644 --- a/DiceView.swift +++ b/DiceView.swift @@ -26,21 +26,27 @@ struct DiceView: View { HStack { Spacer() 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) { - - ForEach(0.. displayDies.count ? Int.random(in: 1...6) : displayDies[index])") - .resizable() - .scaledToFit() - .frame(width: 50, height: 50) + + ForEach(0.. displayDies.count ? Int.random(in: 1...6) : displayDies[index])") + .resizable() + .scaledToFit() + .frame(width: 50, height: 50) + if index != displayDies.count { Image(systemName: multiDieMode) .resizable() .scaledToFit() - .frame(width: 25) + .frame(width: 10, height: 10) } + } }.padding() - } else { - Text("Results are visualised here when you press the generate button") } Spacer() } @@ -63,7 +69,7 @@ struct DiceView: View { multiDieMode = "multiply" } } - } + }.animation(.spring, value: displayDies) } }