What We’ve Learned

In this chapter, you learned techniques that are helpful as projects get bigger. We started by organizing our files into groups, which we can expand, put away, and nest within one another, so we can look at just the files we need at any one time.

Then we looked at Xcode’s support for refactoring…which unfortunately still doesn’t exist. Instead, we did our own refactoring to change class names. Then we took on a bigger project: taking the Twitter code in RootViewController and making it a general-purpose function that can be reused by other classes we’ll be creating later. Since it didn’t need to maintain state, we didn’t have to create a helper class, and instead could split it into a function callable from anywhere in our app. Thanks to the completion handler pattern, callers can send this function an arbitrary closure to perform when the request comes back, which we exercised by having the AppDelegate call Twitter’s suggested topics API.

Now that we’ve genericized our Twitter code, we’re ready to move beyond the single view and give the user the ability to navigate between scenes, each able to take advantage of the work we’ve done so far.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.216.124.145