UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

DAY 20

Project 2, part two


You’re already 1/5th of the way through the 100 Days of Swift, and you’re still coming back – that’s amazing, and I hope you feel proud that your consistency and persistency are paying off.

Years ago Steve Jobs said, "I believe life is an intelligent thing: that things aren't random.” I don’t know whether he’s right or wrong, but I do know that things really ought to be random if we’re playing a game, otherwise it wouldn’t be much fun!

So, today we’ll be completing project two by showing random flags, letting the user make their guess, and showing a score alert. This could have involved using closures for the first time, but here we’re going to take a little shortcut so you can start to get a feel for how closures, functions, and methods are really different flavors of the same thing.

Today you have just two topics to work through, and you’ll meet array shuffling, random number generation, @IBAction, and UIAlertController.

Hopefully those two shouldn’t prove too much work for you, so you should have a little time to experiment with your code before tomorrow’s challenges.

Need help? Tweet me @twostraws!

 

TAKE YOUR SKILLS TO THE NEXT LEVEL If you like Hacking with Swift, you'll love Hacking with Swift+ – it's my premium service where you can learn advanced Swift and SwiftUI, functional programming, algorithms, and more. Plus it comes with stacks of benefits, including monthly live streams, downloadable projects, a 20% discount on all books, and free gifts!

Find out more

Sponsor Hacking with Swift and reach the world's largest Swift community!

100 Days of Swift


The 100 Days of Swift is a free collection of videos, tutorials, tests, and more to help you learn Swift faster. Click here to learn more, or watch the video below.

Back to 100 Days of Swift

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.