Harnessing that power

Cocoa is basically many, many lines of code, written by Apple's own developers, for use on its own platforms. How many lines? I'd love to know, too, but I don't see Cupertino releasing that kind of information anytime soon. Suffice to say, drawing a window on a screen starting with nothing but 1s and 0s is far from trivial, and you should be glad you don't need to do it yourself. Apple has done it for you, millions of times. Despite the fact that drawing such a window involves as much logic as a small Xcode project itself, all you need to do is write a couple of lines of code and there it is, ready for you to add the sexy stuff. All the detail, all that boilerplate, has been abstracted away for you. And the same goes for countless other blocks of repetitive but superbly tweaked code that you will likely never see (and quite possibly never think about again).

All you need to do to make use of this mountain of tested, optimized, and field-hardened code is issue the correct instructions to the libraries, which means knowing the Cocoa API. It's a very large API, to be sure. And nobody--nobody at all, not even at Apple--knows all of it. Some parts you may have learned inside and out already; others you certainly will learn. But for as long as you write Cocoa apps, you will be looking things up in Apple's documentation, or searching Stack Overflow and other developer forums for help and advice.

In case you don't know it (yet), Stack Overflow frequently abbreviated to SO, is one of the most valuable resources on the Web. You can search and read the site without membership, but once you're signed up, you can post questions and, indeed, answer them. The rules are quite strict, and the levels of discipline and respect are very high. Seriously, if you're into development, you'll love SO. It can be found here: http://stackoverflow.com.

The various Cocoa frameworks presented in the second section of this book are those that are likely to be of relevance to a majority of readers. A firm grounding in these topics will provide you with a solid fundament on which to mold Apple's huge repository of code into apps of a professional standard, and with experience of one set of frameworks, you'll find it ever easier to get to grips with new ones, even to the extent that you will often be able to make an educated guess rather than consulting the docs. The Cocoa APIs have been updated to work more expressively with Swift, which in turn means it becomes easier to recognize the patterns being used in the frameworks you use, as the interface between Cocoa and the Swift language itself become more consistent.