How to Create an iOS App
Because developing an iPhone and/or an iPad app requires you to work in an Xcode project, it’s time to create one. The app you’ll be building is called RoadTrip (and will also be the name of the project). The app is like a travel guide on your iOS device. Here’s how you get your RoadTrip project off the ground:
Simply go the Mac App Store, search for Xcode 5, click the Free button, and then click the Install App button that the Free button transmogrifies into, and you are done. After the download, you’ll find Xcode in your Applications folder. Double-click to launch it.
Here are a couple of hints to make Xcode handier and more efficient right from the start:
Create a shortcut. Control-click the Xcode icon that appears in the Dock and then choose Options___Keep in Dock. You’ll be using Xcode a lot, so it wouldn’t hurt to be able to launch it from the Dock.
Nix the Welcome to Xcode screen if you’d like. When you first launch Xcode, you see the Welcome to Xcode screen with several links. (After you use Xcode to create projects, your Welcome screen lists all your most recent projects in the right column.) If you don’t want to be bothered with the Welcome screen in the future, deselect the Show This Window When Xcode Launches check box.
You can also just click Cancel to close the Welcome screen.
If you ever want to see the Welcome screen again, you can access it through the Window menu or by pressing Shift+⌘+1.
2Click the Create a New Xcode Project link on the left side of the Welcome screen, or choose File→New→Project to create a new project.
Alternatively, you can just press Shift+⌘+N.
No matter how you decide to start a new project, you’re greeted by the Choose a Template for Your New Project sheet (a sheet is also known as a document-modal dialog). Its purpose in life is pretty clear: It’s there to let you choose a new template for your new project. Note that the leftmost pane has two sections: one for iOS and the other for OS X.
3In the upper-left corner of the Choose a Template dialog, select Application under the iOS heading (if it isn’t already selected).
After clicking Application, the main pane of the Choose a Template sheet refreshes, revealing several choices. Each choice is actually a template that, when chosen, generates code to get you started.
4Select Master-Detail Application from the template choices displayed and then click Next.
After you click Next, the Choose Options for Your New Project sheet appears.
This Master-Detail Application template provides a starting point for the appropriately named Master-Detail application. What you get is a skeleton app with a split view.
A Split view is what you see in the Mail application. In Landscape orientation on the left is a Master view, and on the right is a Detail view. In Portrait orientation, you see the Detail view with a button that enables you to display the Master view in a popover.
Note that when you select a template, a brief description of the template is displayed underneath the main pane. In fact, go ahead and click some of the other template choices just to see how they’re described as well. Just be sure to click the Master-Detail Application template again when you’re done, and then click Next, to follow along with developing the RoadTrip app.
5In the Choose Options for Your New Project sheet, enter a name for your new project in the Product Name field, and add a company name (or your name) in the Organization Name field. For the Company Identifier, use your reverse domain name (com.yourdomain) if you have one.
If you don’t have one, you can make one up as long as you are not going to be submitting the app to the App Store.
This project is named RoadTrip. (You should do the same if you’re following along with developing RoadTrip.)
Class prefix is something that will get prepended to the classes the template will generate, so enter RT (for RoadTrip) in the Class Prefix field. Prefixes are most often used to distinguish classes created by different teams so that if they are combined into a single project at a later date, duplicate names are avoided. (These are called namespace collisions.)
6Select Universal from the Devices Family pop-up menu (if it isn't already selected).
Doing so creates a skeleton app that will be configured to run on the iPad, iPhone, or iPod touch.
By choosing Universal, you’re creating an app that can run on iPhone (and iPod touch) and iPad.
Any iPhone application will run on the iPad, but it doesn’t work the other way around unless you create a Universal application.
Select Universal because, with the introduction of storyboards in iOS 5 and Xcode 4.2, creating a universal application has become much easier.
Do not select the Use Core Data check box.
7Click Next and choose a location to save the project (the Desktop or any folder works just fine), do not select the Source Control: Create Local Git Repository check box, and then click Create.
Git is a software control management (SCM) system that keeps track of changes in the code and saves multiple versions of each file on your hard drive. Git can be used as a local repository — thus the Create Local Git Repository for This Project option — or you can install a Git server on a remote machine to share files among team members.
If you want to find out more about Git, check out the Xcode 5 User Guide (choose Help→Xcode User Guide).
After you click Create, Xcode creates the project and opens the Workspace window for the project.
Xcode will remember your choices for your next project.