Chap 6 - @State showHistory = false

At the beginning of Chapter 6, you say

“…you should always have a single source of truth.”
and
“A @State property is a source of truth”

But later, you have
@State private var showHistory = false
in both WelcomeView and ExerciseView. Doesn’t that violate a single source of truth rule?

hi! these are two different showHistory properties, one for each view. Think of them as showHistoryInWelcomeView and showHistoryInExerciseView. Each is the single source of truth for its own view.

3 Likes