FREE: Follow my new 100 Days of Swift challenge! >>

< Table of Contents   Next: What are we working with? >

Setting up

This technique project is different to all the others so far. You see, I've already written all the code for you and I'm giving you a working app. Sure it has a few bugs here and there, but it's not too bad. Well, OK: perhaps it's full of bugs, and perhaps this whole project is about showing you how to find and fix those bugs!

We're going to be using a tool called Instruments. It ships as part of Xcode, and is responsible for profiling your app. "Profiling" is the term used when we monitor performance, memory usage and other information of an app, with the aim of improving efficiency.

I'm not going to make you a master of Instruments, but I can at least show you how it helps you find problems with your code. Plus, along the way you'll learn a few extra bits about how iOS works, including shadows, image caching, cell reuse and more.

You should download the source code for this project from GitHub ( then modify it as we go. When you open the project, change the the build destination to be your iOS device if you have one handy, otherwise use the iPhone 8 simulator.

Please note: it's recommended you use physical devices when profiling your apps because their performance characteristics are very different from those of the iOS simulator. It's not required, just strongly recommended. If you're going to choose a device, I recommend choosing the least powerful device you support so that you can be sure it still works OK. Trust me: if your code works quickly enough on an ancient iPad, it will run like lightning on an iPad Pro.

Cunningly, some options we’ll be looking at – such as “Color Blended Layers” – are available only in the simulator, so you’ll need to use that alongside a real device.

< Table of Contents   Next: What are we working with? >
Buy Testing Swift Buy Practical iOS 12 Buy Pro Swift Buy Swift Design Patterns Buy Swift Coding Challenges Buy Server-Side Swift (Vapor Edition) Buy Server-Side Swift (Kitura Edition) Buy Hacking with macOS Buy Advanced iOS Volume One Buy Advanced iOS Volume Two Buy Hacking with watchOS Buy Hacking with tvOS Buy Hacking with Swift Buy Dive Into SpriteKit Buy Swift in Sixty Seconds Buy Objective-C for Swift Developers Buy Beyond Code

Was this page useful? Let me know!

Click here to visit the Hacking with Swift store >>