I'm sure this is a basic question, but I'm new to this style of development, so thought Id ask... I've worked through Apple's dice roller demo, so far so good - I'm using the code below to render and roll a single die; struct DieView: View { init(dieType: DieType) { self.dieValue = Int.random(in: 1...dieType.rawValue) self.dieType = dieType } @State private var dieValue: Int @State private var dieType: DieType var body: some View { VStack { if self.dieType == DieType.D6 { Image(systemName: die.face.(dieValue)) .resizable() .frame(width: 100, height: 100) .padding() } else { Text((self.dieValue)) .font(.largeTitle) } } Button(Roll){ withAnimation{ dieValue = Int.random(in: 1...dieType.rawValue) } } .buttonStyle(.bordered) Spacer() } } Again, so far so good - works as I'd expect. I can now also add multiple DieViews to a DiceSetView and they display as I'd expect. Where I'm stuck is in the DiceSetView, I want to both determine the total score across the dice, and also offer the ability to Roll All the
Topic:
UI Frameworks
SubTopic:
SwiftUI