EngineeringiOS 7 Xcode 5.1

Apple released a new version of iOS and Xcode (iOS 7.1 and Xcode 5.1) last week that included many features and fixes that were long-awaited. Other than the support for CarPlay, the update includes several significant enhancements and additions.

Here’s what stood out:

  • Noticeable new design for the phone app, introducing more of the rounded buttons

  • A few design tweaks to the Calendar and Weather app

  • Improvements to Siri’s sound in a few languages (Japanese, Australian English, Mandarin Chinese, and UK English)

  • Improved responsiveness for TouchID on iPhone 5S devices

  • Improved responsiveness for TouchID on iPhone 5S devices

  • Improved responsiveness for TouchID on iPhone 5S devices

  • And most importantly, fixes to the “white screen of death”, as this update promises less crashes

I bet you’ve already read this somewhere before. We’re here to talk more about the changes that are more interesting to developers, in both iOS 7.1 and Xcode 5.1.

 

 

1. Debugger quick look for custom classes

 

In Xcode 5.0, Quick Look was introduced for displaying variables’ content while debugging. You can either use the small eye icon to view a graphical representation of the variable, or the i icon to view the contents of it. This feature supported system classes as strings, arrays, dictionaries, as well as UIColor, images, views, and locations.

quicklook

With the release of Xcode 5.1, this feature is being extended to support custom classes as well. All you need to do is implement the -debugQuickLookObject and return any of the supported types.

Here is a quick example that returns a static NSString. You can customize it to return the contents of the class or more relevant data.

@implementation InstabugCustomClass
- (id)debugQuickLookObject {
    return @"Testing debug quick look";
}
@end

Screen Shot 2014-03-16 at 11.07.52 AM

 

What is even more interesting is that you can return other data types such as attributed strings or even UIImages.

@implementation InstabugCustomClass
- (id)debugQuickLookObject {
    UIImage *logo = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Instabug"
                                                                                     ofType:@"png"]];
    return logo;
}
@end

Screen Shot 2014-03-16 at 11.28.35 AM

 

 

2. Enhancements to auto layout constraints

 

autolayout

Xcode 5.1 (left) vs Xcode 5.0 (right)

Among a few new additions to the auto layout constraints and Interface Builder, auto layout now offers a full suite of possible constraint types, including cross attribute alignments, so you can set constraints such as view1.centerY = view2.bottom or view1.bottom >= view2.top.

You can also create constraints with ratios or proportions, not only constants, so you can set it to any of the presets (4:3, 16:9) or your custom fraction or decimal (0.5 or 1/2).

 

 

3. Arm64 is now included by default

 

All apps using default build settings now include a build for arm64 as well as the 32-bit architectures. So if your projected wasn’t targeting 64-bit architecture, you’ll have to set the build architectures not to include arm64.

Screen Shot 2014-03-16 at 11.56.09 AM

You can also now have your project supporting iOS 5.0+ while including an arm64 build without doing any hacks or custom build scripts.

 

 

4. Emojis

 

Last but not least, Xcode now supports including emoji and other unicode characters in your scheme settings and project files.