O'Reilly logo

iOS 8 SDK Development, 2nd Edition by Janie Clayton, Chris Adamson

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

Using Another TwitterAPIRequest

To prove all this refactoring has been worth it, let’s see how much easier it’ll be to add Twitter calls to our existing classes or those we may yet create.

Just for kicks—and with the understanding we’ll undo this silly code in a few minutes when we’re done with it—take a look at AppDelegate.swift. This class has to do with how our app interacts with the rest of the system, something we’ll talk about more in Chapter 13, Launching, Backgrounding, and Extensions. For now, notice there is a method called applicationWillEnterForeground. This is called when the app is brought back to life from the background. Let’s do a Twitter call every time this happens.

To do so, we will be using a TwitterAPIRequest, and making ...

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