Your First iOS and SwiftUI App · Challenge: SwiftUI State |

This is a companion discussion topic for the original entry at

why use two alarms ?
instead of using @State textMsg to change the alert text based of button clicked ?

alertIsVisible → I see this state variable is instantiated as false, and is set to true on button click. Later, its never set to false, but when I dismiss alert and press the button, I see alertIsVisible shows false :o yet, we don’t set it to false after it has been set true. Why so?

Never mind, I guess whenever the state variable changes, its value is reset to instantiation value because the whole View is reset…

For me I was trying to build it up from the start like how you showed us.
But Xcode keeps showing errors making me think I’m doing it wrong.
Mostly to see if I could do it.