WWDC23 SALE: Save 50% on all my Swift books and bundles! >>

DAY 45

Project 9, part 3

Today we’re going to push your drawing skills to the limit by looking at special effects and animation. As we’re right at the advanced edge of drawing it’s fair to say these skills are less likely to be used in everyday coding, but as Ralph Waldo Emerson once said, “we aim above the mark to hit the mark.”

As you’re working through today’s topics you’ll learn how to animate shapes, and it’s another instance where SwiftUI can feel a bit like magic. As you’ve seen previously, though, it really isn’t magic – SwiftUI just responds to the way we configured our views. It’s a bit like a Rube Goldberg machine: we set things up exactly right, put the whole machine in motion, then watch as the correct output comes out.

Controlling animation is no different: we don’t want to have the body property of a view re-invoked 60 or 120 times a second in order to get smooth animation, so instead we just provide the instructions for what should change as an animation progresses. It’s not terribly discoverable – that is, you can’t stumble upon the solution by accident – but I hope you’ll agree that it’s straighforward to use.

Today you have three topics to work through, plus one bonus topic if you’re feeling brave. You’ll learn about blend modes, animatableData, AnimatablePair, and more.

And if you’re feeling brave:

I hope you’re able to share some screenshots or videos with what you made today – if you use Twitter make sure you add @twostraws to your tweet so I can see!

Share your progress!

If you use Twitter, the button below will prepare a tweet saying you completed today, along with a celebratory graphic, the URL to this page, and the challenge hashtag. Don't worry – it won't be sent until you confirm on Twitter!

Need help? Tweet me @twostraws!


Save 50% in my WWDC23 sale.

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.

Save 50% on all our books and bundles!

100 Days of SwiftUI

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

Back to 100 Days of SwiftUI

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.