Xcode is the development environment used to create apps for iOS and OS X. Download and install the latest version of the Xcode App from the Mac App store. Also included in the Xcode developer toolset is Xcode IDE, iOS Simulator, and all of the tools and frameworks required for developing an iOS app.
Read the following:
Other resources:
As you read your lesson, pay close attention to the key terms and phrases listed throughout the lesson. These terms and concepts are important to your understanding of the information provided in the lesson.
To download the latest version of Xcode, open the Mac App Store on the Mac computer. Do a search for Xcode. The app is free. Install the app on the Mac computer. Be patient during the installation of the App since it is a large file and may require additional time.
Xcode does get upgraded periodically. Look at the Versions Compare Table on Wikipedia for more information.
The Welcome to Xcode screen will appear after installing the development tool. To start a new project, select Create a new Xcode project. The welcome screen provides the following information: the version of Xcode in use, the ability to connect to a repository previously created, a direct link to Apple's developers' portal, and a list of recently worked on programs. If the welcome screen does not appear when Xcode is opened, a new project can be started by selecting File > New > Project from the Xcode menu.
After a new project is created, the Select Template screen appears. When selecting a template there is an option to develop Xcode for iOS or for OS X, which is the Mac operating system. This course focuses on development of iOS apps, therefore, the selection of iOS will show the appropriate templates. The most common template that will be used in this course is the Single View Application template. This template provides a nice starting point for app development. It provides a view controller to manage the view, and a storyboard or nib file that contains the view. However, more complex templates are available for use, including Master-Detail Application or Tabbed Application. For a 3-dimensional gaming app, the openGL Game template is advised. There is also an option to start an application from scratch with the Empty Application option.
After a template is chosen, the Choose Options screen will appear.
Upon saving a project, where the project has been saved will be the location of the project and the associated files. The Source Control option at the bottom of the screen can be checked to create a local git repository for the current project. This option is only for developers planning on creating different versions of an application in order to keep a history of the previous work that has been done.
The tutorial videos used in this lesson will explain how to use and create a project in Xcode. The videos will take the viewer through the development of a simple coin toss app which simulates the flipping of a coin. The first video, Xcode Tutorial – Introduction to Xcode and iOS Development (5:54) discusses the strategy involved with developing an app.
Each component of the Xcode window is described below:
To locate basic application information, click on the name of the project at the top of the navigation area. Six different tabs appear. The General tab provides information such as the Bundled Identifier, the Version and Build, the targeted device and its operating system version, the name of the main storyboard, and the device orientations that can be used for the project, the status bar being used, the app icons used to start the program, launch images, and linked frameworks and libraries.
The other tabs will be covered in other lessons of this course.
The ViewController has three parts that make up the interface interactivity that will appear in the app.
The main.storyboard file is discussed in Xcode Tutorial 2 – Intro to Storyboards (6:45). View Controllers are added to create basic navigation.
There are two different editing views: the Standard editor view and the Assistant editor view. The user can toggle between the two views by going to View from the menu bar or using the icons in the Toolbar. Standard editor view provides one large pane to edit code. The Assistant editor view allows the user to view and edit panes of codes side by side. For example, the interface and a second section of code can be edited at the same time. This view is also handy for referencing other code.
The Organizer can be accessed by selecting Window from the menu bar. Organizer deals with the hardware that is set up and to deals with repositories, or versions of the apps history. The organizer will show the devices that are associated with the app being created such as an iPhone or iPad. Specific devices can be set up if the developer is a paid developer or a member of the university agreement. A device may be added to perform device testing of the app.
From the menu bar, select View > Navigators and select one of the following:
In the interface builder there will either be a .storyboard or a .xib file to open. The .xib file is the only option for versions prior to iOS 5. A .storyboard file is used by default for all current versions. The right hand side of the screen will include two panes: an Inspector pane on the top and a Library pane on the bottom.
The Library pane includes the following options:
The Inspector pane is contextual to whatever is selected and includes the following options:
View the following videos:
Xcode Tutorial #3 – Storyboard: Labels and Buttons (3:50). This video demonstrates how to edit labels and buttons on the storyboard.
Xcode Tutorial 4 – Adding a Navigation Controller to your Storyboard (4:28). This video talks about using the Navigation Controller and adding buttons to create the navigation structure of the app.
Xcode Tutorial #5 – Image Views (3:02). This video adds images to the Xcode project by creating an Image View.
Xcode Tutorial #6 – Use an Image as a Button (1:47). This video demonstrates how to use an image as button.
The simulator allows the developer to test the build of the app during the development process. The simulator provides an option for selecting the device on which the simulation will be completed on including the version of the iOS. During simulation, major errors in the application being developed can surface.
The controls for iOS Simulator are in the upper left corner of Xcode. Select the device to test the app on. Select the Play button to build and then run the current scheme. Xcode will build the project and launch the most recent version of the app in the iOS Simulator.
iOS Simulator can also be launched without running an App. A developer may choose this approach to test how the app launches from the Home screen of a device. To launch iOS Simulator:
iOS Simulator displays the Home screen of the simulated device that was last used. All of the apps that are installed on the Home screen are available.
This lesson introduced the student to Xcode and its function. The steps of creating a project were discussed in detail as well as different options available for the app. An introduction of the Xcode interface was presented including the parts of the Xcode window, navigation views, and interface builder. The student should be able to navigate throughout Xcode in order to start a project.
This work is created by the National Information Security and Geospatial Technologies Consortium (NISGTC), and except where otherwise noted, is licensed under the Creative Commons Attribution 3.0 Unported License.
Authoring Organization: Collin College
Written by: Original Author, Elizabeth Pannell; Edited Version, Susan Sands
Copyright © National Information Security, Geospatial Technologies Consortium (NISGTC)
Development was funded by the Department of Labor (DOL) Trade Adjustment Assistance Community College and Career Training (TAACCCT) Grant No. TC-22525-11-60-A-48; The National Information Security, Geospatial Technologies Consortium (NISGTC) is an entity of Collin College of Texas, Bellevue College of Washington, Bunker Hill Community College of Massachusetts, Del Mar College of Texas, Moraine Valley Community College of Illinois, Rio Salado College of Arizona, and Salt Lake Community College of Utah.
This workforce solution was funded by a grant awarded by the U.S. Department of Labor's Employment and Training Administration. The solution was created by the grantee and does not necessarily reflect the official position of the U.S. Department of Labor. The Department of Labor makes no guarantees, warranties or assurances of any kind, express or implied, with respect to such information, including any information on linked sites, and including, but not limited to accuracy of the information or its completeness, timeliness, usefulness, adequacy, continued availability or ownership.