The third beta of Xcode 6.3 was released on March 12. The IDE offers several handy new features, and fixes a fair few issues with its earlier versions too. Let us have a look-see of the main points of interest in the new Xcode version.
About a week back, Apple seeded the third beta of Xcode 6.3 to developers. The initial feedback has been favorable, with many of the new features in the latest version of the integrated development environment coming in for particular praise. The general consensus seems to be, Xcode 6.3 (with Swift 1.2) is going to make iPhone app development easier and more streamlined. In this discussion, we will take a tour through the best new features in Xcode 6.3:
- Updated compiler functionality – Version 6.1 of the LLVM compiler has been built into the Xcode 6.3 environment. iOS developers would get greater convenience while working with the arm64 architecture. The vector intrinsics system has also been tweaked around, to suit the specifications of the ARM compiler. The option of automatic generation of warning diagnostics is a nice addition as well.
- Swift Migrator tool – For Mac and iOS app developers working with Xcode 6.1.1 and Swift 1.0/1.1, this is a very useful feature. The Swift Migrator allows coders to seamlessly port their source codes to Swift 1.2 – without any risks of loss of unsaved data. All that users have to do is click on Edit → Convert → To Swift 1.2.
- Language enhancements for Objective-C – Xcode 6.3 comes with significant language enhancements for Objective-C (a further proof that Apple has no plans to phase out the language anytime soon). The new version of the Xcode IDE supports the ‘nullability’ feature – which enables programmers to declare variables, parameters and return types with greater flexibility. Block pointers and C pointers can also be used along with the nullability qualifiers. What’s more, addition of ‘nullability’ to the Obj-C API does not, in any way, affect the process of code-generation by the compiler.
- Rectified Interface Builder – A common complaint among Mac/iPhone app development experts about the earlier betas of Xcode 6.3 was the random misalignment of the different ‘Views’. Xcode 6.3 beta 3 ensures that all ‘Views’ have built-in autoresizing masks. Since they are now stored inside the class references (NSScrollView, UITableView, etc.), there are no chances of misalignment either. Clearly, the developers at Apple have paid heed to the early feedback from Xcode-users.
- Improved debugger functionality – Mobile app testing is likely to become simpler, quicker and more foolproof in the Xcode 6.3 framework. Every expression in Objective-C, C and C++ are evaluated in it by a default prototype (for printf ()). The new LLDB setup makes the overall testing/debugging experience on arm64 devices more efficient. The only thing iOS developers working with the latest version of Xcode have to be wary of is the declaration of conflicting printf (), which would generate errors in .lldbinit.
- Language enhancements for Swift – Xcode 6.3 offers coders the first feel of Swift 1.2, and has a host of new enhancements for the already-popular programming language. Targets can now be built incrementally, which ensures that each and every source file in Swift does not have to be rebuilt (as was the case in the earlier Swift versions). Multiple optionals can also be tested with the ‘if let’ construct, in Xcode 6.3/Swift 1.2. Coders from iOS app companies have also pointed out the new Set data structure (which can be bridged with NSSet) as an important addition to the overall Xcode playground. The new data structure supports full value semantics, and makes the usage of unique elements in app codes easier.
- Smooth exporting of Swift enums – Swift had always been positioned as a language which can work concurrently with Objective-C, and here is another proof of that. Xcode 6.3 beta 3 introduces a new functionality – that of exporting Swift enums to an Objective-C platform. The @objc attribute has to be used for this purpose. In Objective-C, enums do not have the ‘namespacing’ feature. This, in turn, makes it mandatory for developers coding for iOS apps to concatenate the name and case of every Swift enum, before exporting it to Obj-C.
- Runtime discrepancy detection – Another high point of Swift 1.2 in Xcode 6.3 is the language’s ability to automatically detect the the difference between ‘overriding’ and ‘overloading’ in the type system of Swift. Since the discrepancy is detected in the runtime environment, chances of bugs and errors staying undetected are minimized. For instance, conflicts between a ‘setProperty’ method and the ‘property’ setter (in Objective-C) can now be diagnosed and corrected on a real-time basis.
- Arrival of dynamic casts – The new version of the Xcode environment has finally made dynamic casts completely compatible with all protocol types declared in Swift. There is one condition though: the protocol types to be included in dynamic casts cannot have any additional associated types. Mobile app developers and coders have reported that including conformances (with a ‘struct point’) into the Xcode Playground has become simpler as well.
- More predictability and stability in Swift – The option of converting bridged classes from Objective-C to matching value types in Swift (e.g., ‘NSDictionary’ to ‘Dictionary’, or ‘NSString’ to ‘String’) has been done away with in Xcode 6.3 beta 3. Reports from Mac/iOS app development forums suggested that such implicit conversions caused uncertainties regarding Swift outputs. With that now gone, developers can now code with greater certainty.
- Better handling of unowned references – Swift objects that were inherited from Objective-C were often the cause of sudden runtime crashes. The same can be said about most types of unowned references in Obj-C. That, much to the delight of software and app developers, is no longer a concern. Even when the coder deallocates the object that is holding an unowned reference, the entire program will not crash. One less thing for developers to worry about!
- Changes in the Intrinsics of ARM64 – The way in which arguments are ordered in the Xcode IDE has undergone a thorough change. The good thing is, coders can move over to the new behavior easily – and as soon as they set the value of USE_CORRECT_VFMA_INTRINSICS to ‘1’, the compiler will be instantly intimated about it. Keeping the value to ‘0’ implies that the old behavior is being retained. According to experts in the domain of Xcode programming and iOS app development, adopting the new behavior ensures that proper runtime warnings are generated (conversely, warnings are muted if the value is ‘0’). These changes affect all arm64 vfma intrinsics.
- No crashes due to subclasses – Another nice advancement to Swift that Xcode 6.3 brings to the table. Unlike the case in the earlier versions of the IDE, subclasses can safely be declared in Xcode 6.3 (in Optional Types), that have contravariance or covariance specifications. App code testers have confirmed that such subclasses are not likely to cause crashes at runtime.
- Conversion of NS_ENUM from raw integers – Professional iOS/Mac developers no longer have to rely on the ‘unsafeBitCast’ method to convert raw integer values to NS_ENUM types. Even a type that has an undocumented value (for example, UIViewAnimationCurve) can be successfully generated from its original raw integer value. There is a separate initializer – init (rawValue:) – for this task.
The new crash reporting system in Xcode 6.3 (available in beta 2) is yet another important addition to the IDE. The reports from unsuccessful NSClassFromString lookups can be compared with nil, without any random results being generated. The standardization of the class and struct initializers is yet another thing that makes the life of iOS app coders easier. The iOS 8.3 beta 3 SDK has also been included in the third beta of Xcode 6.3.
All things said, Xcode 6.3 is still in the beta stage – and more changes are likely to be made, before its final release. There still remain niggling problems with WatchKit project management, as well as the general IDE templates. Once those are ironed out, Xcode 6.3 can indeed become a truly great upgrade for iOS developers.