Project 29 was a serious game with a lot going on, not least the dynamically rendered buildings with destructible terrain, the scene transitions and the UIKit/SpriteKit integration.
And in project 30 we took our first steps outside of Xcode and into Instruments. I could write a whole book on Instruments, partly because it’s extremely powerful, but also because it’s extremely complicated. As per usual, I tried to cherrypick things so you can see useful, practical benefits from what I was teaching, and certainly you have the skills now to be able to diagnose and result a variety of performance problems on iOS.
Here are some of the things you learned in this milestone:
resignFirstResponder()on a text view. (And remember: it also works on text fields.)
LAContextfrom the LocalAuthentication framework to require Touch ID authentication.
stride()function to loop across a range of numbers using a specific increment, e.g. from 0 to 100 in tens.
usesPreciseCollisionDetectionto make collisions work better with small, fast-moving physics bodies.
presentScene()method and passing in a transition effect. We’ll be using this again in project 36, so you’ll have ample time to practice transitions.
.clearto erase parts of an image. Once that was done, we just recalculated the pixel-perfect physics to get destructible terrain.
layer.shadowRadiusand other properties – and particularly how to use the
layer.shadowPathproperty to save shadow calculation.
dequeueReusableCell(withIdentifier:)so that iOS can re-use cells rather than continually creating new ones.
UIImage(named:)initializer has an automatic cache to help load common images. When you don’t need that, use the
SPONSORED Play is the first native iOS design tool created for designers and engineers. You can install Play for iOS and iPad today and sign up to check out the Beta of our macOS app with SwiftUI code export. We're also hiring engineers!
Link copied to your pasteboard.