NEW: Start my new Ultimate Portfolio App course with a free Hacking with Swift+ trial! >>

DAY 39

Project 9, part one


Joss Whedon, the creator of Firefly, once said that “the secret to multitasking is that it isn't actually multitasking – it’s just extreme focus and organization.” (If you weren’t aware, Firefly played a big part in the development of Swift – the internal code name (“Shiny”) was from there, the original documentation mentioned the series a lot, and you’ll even find references to Firefly in my work!)

Of course, computers operate very different from people: an iPhone XS has six CPU cores inside, and each of those six things can work independently of the others. If you use just one of them – as we have been doing all this time – then your app will never come close to using the full power of the device.

So, to make the most of those cores we need to do real multitasking: not just extreme focus and organization, but dividing up work that can happen simultaneously across as many cores as we need.

This is traditionally A Very Hard Problem, but Apple has a framework called Grand Central Dispatch that makes it remarkably easy. It does, however, use closures, so brace yourself!

Today you have five topics to work through, and you’ll learn about Grand Central Dispatch, quality of service queues, performSelector(), and more.

Need help? Tweet me @twostraws!

 

Hacking with Swift is sponsored by Instabug

SPONSORED Catch bugs as soon as they happen and know exactly why a crash occurred. Instabug's SDK grabs all the logs they need to fix bugs, crashes and performance issues in minutes instead of days. Get screenshots, device details, network logs, repro steps, and tons of other critical insights needed to resolve issues and prioritize product backlogs straight from your dashboard. It only takes a minute to integrate!

Get started now

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.