Xcode 4.4 Changes

July 30th, 2012

Filed under: Xcode | Be the first to comment!

Xcode 4.4 is now out for Mac OS X 10.7 and 10.8. It’s going to take some time for me to update the Xcode book for Xcode 4.4 so I’m writing this post. This post provides a brief explanation of the changes I noticed in Xcode 4.4 that affect the material in the book. You can read about additional changes in Xcode 4.4 in the following document from Apple:

New Features in Xcode 4.4

Organization Name in Source Code File Copyright Notice

When you name your project in the Product Name text field, you will see an Organization Name text field. The name you specify in the text field appears in the copyright notice at the top of each new source code file Xcode creates for the project. The Organization Name text field comes as a great relief to people who were tired of their source code files having the name My Company Name in the copyright notice. 

If you make a mistake entering the organization name, you can fix it by selecting the project file from the project navigator and opening the file inspector. Enter a new name in the Organization text field in the Project Document section of the file inspector.

Project and File Templates

The Other category under both Mac OS X and iOS has a project template for creating in-app purchase content. Most of you will add a target to an application project instead of creating a new project for in-app purchase content.

Xcode 4.4 no longer has a Sync Schema project template, which was in the System Plug-In category under Mac OS X.

The Cocoa and Cocoa Touch categories have an Objective-C class extension file template, which generates a class extension header file. A class extension allows you to declare parts of a class’s interface (the @interface section you find in Objective-C header files) outside the class’s public header file.

Refactoring Tools

Xcode 4.4 adds a new refactoring tool, which you can access by choosing Edit > Refactor > Convert to Modern Objective-C Syntax. If you have done any work with Objective-C strings, you know the @ character signifies the start of a string literal.

NSString* myString = @"Hello";

In Xcode 4.4 you can use the @ character to initialize numbers, arrays, and dictionaries.

NSNumber* myNumber = @7;
NSNumber* myFloat = @2.5f;
NSArray* myArray = @[@1, @2, @3, @4];
NSDictionary* myDictionary = @{@1: @"red", @2: @"green", @3: @"blue", @4: @"alpha"};

In addition to refactoring your code to use the new support for literals, the refactoring tool implements the [ ] syntax convention for Objective-C containers, such as arrays and dictionaries. The new syntax lets you access an element in an array with the following code:

myArray[3];

Instead of the following:

[myArray objectAtIndex:3];

According to Apple’s documentation, the modern Objective-C syntax requires the use of the Mac OS X 10.8 SDK. Code that uses the syntax runs on 10.7 and later. iOS support is coming soon.

Code Completion

Xcode 4.4 integrates Quick Help with code completion. When you select an item from the completion list, the bottom of the list shows the Quick Help documentation for the selected item.

Editing DAE Files

Xcode 4.4 provides an editor for 3D models. In your 3D modeling program, export the model as a DAE file. Add the DAE file to your project. When you select the DAE file from the project navigator, you can view and edit it in Xcode.

You must be running Mac OS X 10.8 to edit DAE files.

Interface Builder

Xcode 4.4 adds the following user interface elements for Mac OS X: byte count formatter, page controller, scene view.

Xcode 4.4 adds a split view controller for iOS projects.

Modeling Tools

The data model inspector no longer has a Synchronization section for syncing entities, attributes, and relationships.

Icon Composer

Icon Composer no longer comes with Xcode. It is part of the Graphics Tools package. You can download it from Xcode by choosing Xcode > Open Developer Tool > More Developer Tools.

Base Internationalization

If you select the project from the project editor and click the Info button at the top of the editor, you will see a Use Base Internationalization checkbox. If you select this checkbox, Xcode creates a Base localization, which for most of you is based on English. Using a Base localization makes localizing your application easier.

Suppose you have a xib file to localize. Prior to using base internationalization, you needed one xib file for each language your application supports. By using base internationalization, you use one xib file with a strings file for each language your application supports.

Build Settings

New Cocoa application projects are initially set to build for 64-bit Intel.

Version Control

Xcode 4.4 adds support for cherry picking changes to git repositories. If you make multiple changes to a file, you can now commit or discard a single change. Previously you had to commit all the changes to a file or discard all changes when committing from Xcode.

When you commit a file a sheet opens that highlights the changes you made to the file. The sheet shows two versions of the file: the local version on your hard disk and the last version you committed to the repository. Between the two versions of the file is a button. Click the button and choose Don’t Commit to tell Xcode not to commit the change. Choose Discard Change to discard the change. Repeat this for each change you don’t want to commit. Click the Commit button to commit the remaining changes.

You can also discard individual changes to a file by using Xcode’s version editor. Click the button between the two versions of the file and choose Discard Change.

Facebooktwittergoogle_plusredditmail

Tags:


Leave a Reply

Your email address will not be published. Required fields are marked *