Group Group Group Group Group Group Group Group Group

[State & Data Flow. Part2] ScoreView uses @Binding for `numberOfAnswered` but never mutates it, use `let` instead?

Hello @jeden ,

I am wandering if property @Binding var numberOfAnswered can be replaced with let numberOfAnswered , sine it never gets mutated inside the view. Or there’s another reason why it’s Binding?

body seems just to display text
var body: some View {
HStack {
Text("(numberOfAnswered)/(numberOfQuestions)")
.font(.caption)
.padding(4)
Spacer()
}
}

Thanks, Dzmitry.

hi Dzmitry! there are answers to this question in an earlier post

1 Like