By Kevin McNeish on Thu, 09/19/2013
Do you have an idea for an app but lack the programming knowledge to begin building it? In this weekly blog series, I will take you, the non-programmer, step by step through the process of creating apps for the iPhone, iPod touch, and iPad. Join me each week on this adventure, and you will experience how much fun turning your ideas into reality can be!
As I write this blog post (September 18, 2013), Apple has officially released iOS 7 and Xcode 5! I'm going to take a detour from my usual topic of building the iAppsReview app and give you an overview of these new tools and technologies. You can check out the regular series here.
What's New in Xcode 5
If you want to create apps for iOS 7, it requires a move to the new Xcode 5. When you first open Xcode 5, you will immediately notice that everything is a little easier to read. Rather than using gray backgrounds, Xcode has white backgrounds for almost all of the panels and toolbars. In the same way that Apple has streamlined and simplified the iOS 7 user interface, they have given Xcode a cleaner, stripped down look, where your content takes precedence over the tools and color is used to identify the primary user interface elements as shown in Figure 1.
|Figure 1 - The cleaner, simpler look of Xcode 5|
Xcode also gives your content precedence by halving the height of the toolbar at the top of the Xcode screen. This required removing the labels under the toolbar buttons, but you can still hover your mouse over a particular button to see a tooltip describing its function.
Xcode iOS 6 / iOS 7 Previewer
It's an understatement to say that the iOS 6 and iOS 7 user interfaces are different. iOS 7 introduces the biggest visual changes since the release of the first iPhone.
If you have apps that you need to support for both iOS 6 and iOS 7, Apple has provided you with some help in the form of the iOS Previewer. As shown in Figure 2, the Previewer allows you to view a scene side by side in different versions of iOS (the iOS 7 version of the scene is shown on the left, and the iOS 6 version of the scene is shown on the right).
|Figure 2 - Xcode's iOS Previewer allows you to view scenes side by side in different versions of iOS.|
This allows you to quickly see what changes to your user interface look like in iOS 6 and iOS 7. To launch the iOS Previewer:
- Display the Assistant Editor by clicking the center button in the Editor button group in the Xcode toolbar.
- In the Assistant Editor's jump bar (located at the top of the Assistant Editor window), click the first segment in the jump bar (usually labeled Automatic or Manual) and select Preview (1) > MainStoryboard.storyboard (Preview) from the popup menu (Figure 3).
|Figure 3 - Launching the iOS Previewer|
Next, in the bottom-right corner of the iOS Previewer, select iOS 6.1 and Earlier from the toolbar as shown in Figure 1.
The center button in this toolbar allows you to toggle the scene between portrait and landscape mode (Figure 4). The button on the right lets you toggle between iPhone 3.5-inch and 4-inch form factors.
|Figure 4 - A scene toggled to landscape mode|
Xcode Documentation Viewer
Xcode documentation has been moved from the Organizer window to its own Documentation Viewer window (Figure 5), which you can launch by selecting Help > Documentation and API Reference from the Xcode menu.
In addition, the Documentation Viewer is much faster than when documentation was displayed in the Organizer window. Getting to the information you need quickly is a real benefit when you are on a deadline!
Unit Testing Becomes a First Class Citizen
When you created a new project in previous versions of Xcode, there was a check box that allowed you to specify if you wanted to include unit tests in your project (a unit test is a method by which individual units of code are tested to determine if they are "ready for prime time." Creating unit tests for your app is a best practice that helps you create a for more stable and reliable app.)
In Xcode 5, unit tests are automatically added to your project, and Apple has created a new Test Navigator (Figure 6) that allows you to manage and run your project's unit tests.
|Figure 6 - Xcode 5's Test Navigator|
You launch the Test Navigator by selecting the fifth button from the left in the Navigators toolbar. If a test passes, a green check mark is displayed to the right of the test. If a test fails, a red check mark is displayed instead.
Later in this blog series, we will create unit tests for the iAppsReview app to show you how it's done, and so you can understand the value of unit testing.
Specifying App Capabilities
Xcode 5 makes it much easier to manage your app's capabilities in the Project Editor (Figure 7).
|Figure 7 - Setting your app's capabilities in the Project Editor|
Certain iO technologies such as Game Center, iCloud, and In-App Purchase require additional configuration in your Xcode project. Xcode 5's Capabilities settings make the job of managing these much easier!
Application Performance Gauges
Starting in Xcode 5, the Debug Navigator displays gauges that indicate CPU and Memory usage (Figure 8).
|Figure 8 - The CPU and Memory gauges in the Debug Navigator|
If you click one of these gauges, Xcode displays a full report including a preliminary diagnosis of any problems (Figure 9).
|Figure 9 - The Memory and CPU usage report|
You can click the Profile in Instruments button to launch Instruments for a more detailed analysis.
Changes to the iOS Simulator
During Apple's special event where they announced the new iPhone 5C and iPhone 5S, they also announced that iOS would be a 64-bit operating system. You can think of this as expanding a two-lane highway into a four-lane highway. It allows for a lot more traffic and the potential for greater speeds. To support this new 64-bit version of iOS, a new option is available in Xcode to run your apps in 64-bit mode. You can select this option from Xcode's Scheme setting as shown in Figure 10.
|Figure 10 - The 64-bit iPhone Simulator|
Another big enhancement to the iOS Simulator is support for syncing documents via iCloud. This feature allows you to test that app documents and data are syncing properly across multiple devices. Very nice!
There are a lot more great features included in Xcode 5, and we'll talk about these in future posts. In my next post I'll take you step by step through converting the iAppsReview app from iOS 6 to iOS 7 and learn about some great new enhancements along the way.