Develop iOS and Mac apps with Xcode, Apple’s integrated development environment (IDE). Xcode provides tools to manage your entire development workflow—from creating your app, to testing, optimizing, and submitting it to the App Store.
At a Glance
Xcode is built to help you build great apps for iPad, iPhone, and Mac.
Use the App Store app on your Mac to download Xcode. It’s free. After you download Xcode, it automatically appears in Launchpad, where you can click the icon for Xcode to launch it.
The Xcode interface integrates code editing, user interface design, asset management, testing, and debugging within a single workspace window. The window reconfigures its content as you work. For example, select a file in one area, and an appropriate editor opens in another area. Select a symbol or user interface object, and its documentation appears in a nearby pane.
You can focus on a task by displaying only what you need, such as only your source code or only your user interface layout. Or you can work with your code and UI layout side by side. You can further customize your environment by opening multiple windows and multiple tabs per window.
Assisted Source Code Editing
Xcode checks your source code as you type it, and when Xcode notices a mistake, the source code editor highlights the error. The source code editor then offers to fix it. Xcode speeds up your typing with intelligent code completion. Xcode reduces your typing by offering ready-to-use code snippets and source file templates. You can easily configure the source editor to display multiple views of the same file or to view multiple related files at once. Search-and-replace and refactoring operations help you make extensive changes to your code quickly and safely. With these and other capabilities, Xcode makes it easier for you to write better code more quickly than you thought possible.
Graphical UI Design
Interface Builder is a visual design editor that’s integrated into Xcode. Use Interface Builder to create the user interfaces of your apps by assembling windows, views, controls, menus, and other elements from a library of configurable objects. Graphically connect these object to your implementation code. With the Auto Layout feature, define rules for your objects so that they automatically adjust to screen size, device orientation, window size, and localization.
The asset catalog in Xcode helps you manage the many images you’ll use for your app’s user interface—items such as icons, launch images for iOS devices, and custom artwork. With the particle emitter editor in Xcode, you can enhance your iOS or Mac game by adding animation effects involving moving particles such as snow, sparks, and smoke. For Mac apps, the Scene Kit editor helps you work with scenes created in 3D authoring tools and exported as COLLADA Data Asset Exchange (DAE) files.
Build your app, and Xcode launches it and immediately starts a debugging session. If you are running an iOS app, Xcode launches it either in iOS Simulator or on an iOS device connected to your Mac. If you are running a Mac app, Xcode launches it directly on your Mac.
You can debug your app directly within the source editor with graphical tools like data tips and the variables Quick Look. The debug area and the debug navigator let you carefully control the execution of your app while you examine the code.
Debug gauges display your app’s resource consumption to help you identify problems before your users do.
Unit Testing and Continuous Integrations
To help you build a better app, Xcode includes unit testing tools. Unit tests are programs that automatically exercise the features of your application and check the results. You should create unit tests that automatically exercise the features of your application, and then monitor the results of the tests and fix any issues from the Xcode test navigator.
You can use the Xcode service, available in OS X Server, to automate the execution of unit tests. From Xcode on your development Mac, you create bots that run on a separate server to execute your unit tests either periodically or on every source code commit.
In addition to running unit tests, bots automatically perform static analysis on your code, build your app, and archive it for distribution to testers or the App Store. While performing these continuous integrations of your app, bots report build errors and warnings, static analyzer problems, and unit test failures.
Automatic Saves, Project Snapshots, and Source Control Management
While you work, Xcode automatically saves changes to source and project files. This feature requires no configuration, because Xcode continuously tracks your changes and saves them. You can revert a file to a previous state with Undo and Revert Document commands.
You can revert an entire project to a previous “snapshot” of a known working version with the Restore Snapshot command. Snapshots provide an easy way to back up the current version of your project. Xcode automatically creates a snapshot before you perform any mass-editing operation, and you can set Xcode to automatically create snapshots in other circumstances. You can also create snapshots manually, such before you add a new feature to your app.
To keep track of changes at a fine-grained level, use the Xcode source control management features. Xcode supports two popular source control systems: Git and Subversion. You can access remote Git and Subversion source code repositories, and you can create local Git repositories. Using the Xcode service, available with OS X Server, you can host Git repositories on your own server.
While you’re coding, Xcode makes detailed technical information available at your fingertips. When you want it, Quick Help keeps concise API information always in view, and Xcode application help is always close at hand with step-by-step instructions for performing common Xcode tasks. Xcode includes extensive documentation for using Xcode, and it provides comprehensive SDK documentation, including programming guides, tutorials, sample code, detailed framework API references, and video presentations by Apple engineers, all viewable from the Xcode documentation viewer. As updated documentation becomes available, it downloads automatically in the background.
App Distribution to Testers and the App Store
Most of your development time is spent on coding tasks, but to develop for the App Store, you need to perform a number of administrative tasks throughout the lifetime of your app. In addition to using Xcode, you’ll use the Member Center web tool to manage developer program accounts and entitlements, and you’ll use the iTunes Connect web tool to check the status of your contracts, set up tax and banking information, obtain sales and finance reports, and manage metadata about the app.
Xcode project configurations help prepare your app for distribution to beta testers and for submission to the App Store. Submitting your app is a multistep process that begins when you sign into iTunes Connect and supply necessary product information. In Xcode, you create an archive of your project and submit it to the store. When your app is approved, you use iTunes Connect to release it by setting the date. (If you are distributing your Mac app outside the store, you follow a slightly different process.)
Many of the screenshots used to illustrate this document are taken from the Adventure Xcode project described in code:Explained Adventure. To explore the Xcode features described in this guide on your Mac, obtain Xcode from the App Store, then download the Adventure project by clicking either link in this paragraph.
This guide introduces you to the major features and capabilities of Xcode. For a hands-on introduction to using Xcode, read either Start Developing iOS Apps Today or Start Developing Mac Apps Today. In each document, you use Xcode to create a simple app, and you learn the basics of programming with Objective-C.