This is a big project, right? Believe me, though: it is worth it – as Thomas Edison once said, “the most certain way to succeed is always to try just one more time.” So, even if you’re having a hard time I encourage you to stick with it – we’re finishing the project today, and I feel confident you’ll be impressed with the final game.
What I think you’ll find is that the code we’re looking it isn’t particularly hard, it’s just that there’s a lot of it. But this is important: it gives you the chance to flex your GCD muscles in a different project, with different purposes, which helps make that knowledge sink in a little more.
You’re also going to meet CaseIterable
for the first time, which is a bit like Codable
– it’s one of Swift’s built-in protocols that makes the compiler generate some code on our behalf. In this instance, though, it’s designed to let us read all the cases of an enum as an array, and it’s useful so that we can make random enemy types in our game.
Today you have three topics to work through, and you’ll learn about CaseIterable
, plus you’ll get more practice with GCD, SKTexture
, and more.
Need help? Tweet me @twostraws!
SAVE 50% To celebrate WWDC23, all our books and bundles are half price, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.
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.
Link copied to your pasteboard.