Part I introduces the Swift language, from the ground up — I do not assume that you
know any other programming languages. My way of teaching Swift is different from
other treatments, such as Apple’s; it is systematic and Euclidean, with pedagogical
building blocks piled on one another in what I regard as the most helpful order. At the
same time, I have tried to confine myself to the essentials. Swift is not a big language,
but it has some subtle and unusual corners. You don’t need to dive deep into all of
these, and my discussion will leave many of them unexplored. You will probably never
encounter them, and if you do, you will have entered an advanced Swift world outside
the scope of this discussion. To give an obvious example, readers may be surprised to
find that I never mention Swift playgrounds or the REPL. My focus here is real-life
iOS programming, and my explanation of Swift therefore concentrates on those
common, practical aspects of the language that, in my experience, actually come into
play in the course of programming iOS.
Part II turns to Xcode, the world in which all iOS programming ultimately takes place.
It explains what an Xcode project is and how it is transformed into an app, and how to
work comfortably and nimbly with Xcode to consult the documentation and to write,
navigate, and debug code, as well as how to bring your app through the subsequent
stages of running on a device and submission to the App Store. There is also a very
important chapter on nibs and the nib editor (Interface Builder), including outlets and
actions as well as the mechanics of nib loading; however, such specialized topics as
autolayout constraints in the nib are postponed to the other book.
Part III introduces the Cocoa Touch framework. When you program for iOS, you take
advantage of a suite of frameworks provided by Apple. These frameworks, taken
together, constitute Cocoa; the brand of Cocoa that provides the API for programming
iOS is Cocoa Touch. Your code will ultimately be almost entirely about communicating
with Cocoa. The Cocoa Touch frameworks provide the underlying functionality that
any iOS app needs to have. But to use a framework, you have to think the way the
framework thinks, put your code where the framework expects it, and fulfill many
obligations imposed on you by the framework. To make things even more interesting,
Cocoa uses Objective-C, while you’ll be using Swift: you need to know how your
Swift code will interface with Cocoa’s features and behaviors. Cocoa provides
important foundational classes and adds linguistic and architectural devices such as
categories, protocols, delegation, and notifications, as well as the pervasive
responsibilities of memory management. Key–value coding and key–value observing
are also discussed here.

0 comments:

 
Top