If you are developing applications for OS X, or are hoping to do so, this book will be your foundation and will help you understand Cocoa, the set of frameworks for developing applications for OS X. You, the developer, are going to love developing for OS X because Cocoa will enable you to write full-featured applications in a more efficient and elegant manner.
About This Book
This book covers the major design patterns of Cocoa and includes an introduction to the Swift language. It will also get you started with the most commonly-used developer tools: Xcode and Instruments . After reading this book, you will understand these major design patterns which will enable you to understand and use Apples documentation a critical part of any Cocoa developers toolkit as well as build your own Cocoa applications from scratch.
This book teaches ideas and provides hands-on exercises that show these ideas in action. Each chapter will guide you through the process of building or adding features to an application.
Often, we will ask you to do something and explain the details or theory afterward. If you are confused, read a little more. Usually, the help you seek will be only a paragraph or two away.
Because of the hands-on nature of the book, it is essential that you do the exercises and not just read the words. Doing the exercises will help build the kind of solid understanding that will enable you to develop on your own when you are finished with this book. You will also learn a great deal from making mistakes, reading error messages, and figuring out what went wrong practical experience you cant get from reading alone. At first, you may want to stick with what we show you, but later in the book when you are more comfortable with the environment, you should feel free to experiment with the exercises and add your own ideas.
Most chapters end with one or two challenge exercises. These exercises are important to do as well. Taking on these challenges gives you the opportunity to test your skills and problem-solve on your own.
You can get help with this book at bignerdranch.com/books , where you will find errata and downloadable solutions for the exercises. You can also post questions and find relevant conversations on the Big Nerd Ranch forums at forums.bignerdranch.com .
We ask that you not use the downloadable solutions as a shortcut for doing the exercises. The act of typing in code has far more impact on your learning than most people realize. By typing the code yourself (and, yes, making mistakes), you will absorb patterns and develop instincts about Cocoa programming, and you will miss out on these benefits if you rely on the solutions or copy and paste the code instead.
There is a lot of code in this book. Through that code, we will introduce you to the idioms of the Cocoa community. Our hope is that by presenting exemplary code, we can help you to become more than a Cocoa developer a stylish Cocoa developer.
Most of the time, Cocoa fulfills the following promise: Common things are easy, and uncommon things are possible. If you find yourself writing many lines of code to do something rather ordinary, you are probably on the wrong track. There is a popular adage in the community which you should bear in mind: Dont fight the framework . Cocoa is opinionated and you will benefit greatly from adapting your way of doing things to its way of doing things.
Prerequisites
This book is written for programmers and assumes that you are familiar with basic programming concepts (like functions, variables, and loops) as well as object-oriented concepts (like classes, objects, and inheritance). If you do not fit this profile, you will find this book tough going. You are not expected to have any experience with Mac programming.
One of the challenges of learning Cocoa programming is learning the Swift language. If you have a basic foundation in programming and know something about objects, you will find learning Swift to be easy. This book includes three chapters to introduce to you to the language. Then you will learn more Swift as you build Cocoa applications throughout the book. If you would prefer a gentler introduction, start with Apples The Swift Programming Language, available in the iBooks store or from developer.apple.com/swift , offers a more gentle introduction. Or, if you can wait until Summer 2015, you can read Swift Programming: The Big Nerd Ranch Guide first.
This is a hands-on book and assumes that you have access to OS X and the developer tools. The book requires OS X Yosemite (10.10) or higher. The exercises are written for Xcode 6.3 and Swift 1.2.
We strongly recommend that you join Apples Mac Developer Program at developer.apple.com/programs . Joining the program gives you access to pre-release versions of Xcode and OS X. These can be very useful when trying to stay ahead of Apples development curve. In addition, you must be a member of the developer program to distribute your apps on the App Store.