Making the Twitter Code More General Purpose
When we’re ready to write these other view controllers to show tweet details and user information, we’re going to need to make new calls to the Twitter API. And considering all the work we did to get our first call working—talking to the ACAccountStore and getting an account and using it to make a request and so on—we really don’t want to repeat all that, right? But right now, that code is all in RootViewController. To make it more general purpose, we’re going to need to extract it, and then generalize it.
To do this, let’s think about how to make a more generic Twitter API caller. The current reloadTweets method uses the ACAccountStore to construct an SLRequest, then calls its performRequestWithHandler ...
Get iOS 9 SDK Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.