So let’s get Xcode on our Macs. Yes, we did say “Mac.” Xcode is a native application that is only available for macOS (which until recently was called “Mac OS X”). Typically, it is available for the current version of macOS and (sometimes) one version back. For this book, we will be working with Xcode 8, which as of this writing requires Sierra (macOS 10.12).
We get Xcode from the Mac App Store, which is always available from the Apple menu in any application. Search for Xcode in the store, and click the Get button. Don’t worry, it’s free, but you will need to have an Apple ID to get apps from the store. Actually, you’ll need an Apple ID for a bunch of other tasks later, so create an Apple ID now if you don’t have one, either in the Mac App Store app or at https://appleid.apple.com.
Xcode is an integrated development environment (IDE), meaning it combines many of the tools we need to create apps:
A text editor, in which we write code
Interface Builder, for creating user interfaces visually, rather than in code
A build system, to convert our source code and user interface files into runnable apps
A Simulator, allowing us to run our apps in a window on the Mac, which is sometimes more convenient than running on an actual device
Debugging tools, which help us find and fix errors in our code
Profiling tools, for finding performance bottlenecks at runtime
Testing tools, to verify the correctness of our code and ensure that fixed bugs don’t return
A documentation viewer, containing the full developer documentation for the iOS, macOS, tvOS, and watchOS SDKs
Organizational tools, for preparing and archiving the apps we submit to the App Store
That’s a lot of stuff to fit in one app! It might be overwhelming, but our first run of Xcode will offer a pretty gentle introduction. Launch Xcode from the Applications folder (you may want to put it in your Dock, too), and click OK if it asks to install additional components, which are the command-line executables that will build our projects for us. When we get to the first window, Xcode keeps things simple:
We start with three simple options: “Get started with a playground,” “Create a new Xcode project,” and “Check out an existing project.” On the right, there’s a blank space that says No Recent Projects as we start working in Xcode; this will fill in with a list of our Xcode creations.
For now, let’s start off with a little directed play.