|
I'm trying to figure out how to consistently delay the "finalScore" (ending game) alert to pop up after the "scoreTitle" (round ending) alert in challenge 25. I can't seem to get the alerts in a consistent order in whichever way I try.
|
|
@Maz gives us a great opportunity to think about declarative vs procedural programming!
Procedural ApproachIn a procedural programming approach, you might have pseudo code like this:
You see? When one task completes, the compiler will move onto the next statement in order. The compiler follows the procedure as dictated by the developer. Declarative ApproachIn a declarative approach, you add a If some other As a programmer, it's your job to declare what is shown to the user under the various application states.
Now your logic becomes: under which situations should Logic in States == Switches on a DashboardIn short, you don't line up several alerts to trigger a chain reaction. To help visualize this, think of |
|
Thanks,
|
|
This code was using the correct alert order in the UI preview, but not when running the app so I changed it to this and it worked in the running the app.
|
|
Nice job figuring this out! Here's a free hint to consider. Consider adding a var to your
Just some suggestions. |
SPONSORED From March 20th to 26th, you can join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer!
Sponsor Hacking with Swift and reach the world's largest Swift community!
You need to create an account or log in to reply.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.