O'Reilly logo

Cocoa Programming for OS X: The Big Nerd Ranch Guide by Aaron Hillegass, Adam Preble, Nate Chandler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Improving Scattered: Time Profiling in Instruments

Open the Scattered project from the previous chapter and find addImagesFromFolderURL(_:) in ViewController.swift. Find the allowedFiles variable, which is used to limit the number of files opened to ten. Remove all traces of allowedFiles and run the application.

You should see the Scattered app’s icon bouncing in the dock for several seconds. When the window appears, all the images will already have been animated to their destinations. It looks like loading the images is blocking the main thread, which is a poor user experience. You may have a pretty good idea that the problem is related to loading images, since you just removed the limit, but let’s prove it.

Introducing Instruments ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required