News

Apple Unveils New iOS 8 SDK and Programming Language

Apple Inc. made waves at its Worldwide Developers Conference with the release of a huge mobile SDK for its new iOS 8 and a new programming language called Swift.

Calling it the "biggest developer release ever," Apple said the iOS 8 SDK contains more than 4,000 new APIs, echoing the company's consumer focus with new features for tracking personal health, home automation, gaming and entertainment.

Swift, the new programming language for use in Apple's Xcode 6 IDE, is designed for developers using Apple's Cocoa Touch API to create mobile apps for iOS or the Cocoa API to build desktop apps for OS X.

The iOS 8 SDK includes APIs for the new HealthKit and HomeKit frameworks, along with a new graphics technology called Metal aimed at gaming apps.

HealthKit APIs let health and fitness apps communicate with one another -- for example, a blood pressure app could share data with a physician app for better, integrated health care.

HomeKit provides a common protocol for secure pairing with home automation devices so users can control single devices or groups of devices, even using the Siri personal assistant software to prepare a house for nighttime, for example.

Metal maximizes gaming performance on the A7 chip, Apple said, providing up to 10x improvement in draw call speed. "Metal enables leading game providers for the first time to bring console-class 3D games to mobile devices," Apple said in a statement. "For casual games, iOS 8 now features SceneKit, making it easy to create fun 3D games, along with major enhancements to SpriteKit, including field forces, per-pixel physics and inverse kinematics."

The iOS 8 SDK also includes: Touch ID APIs for authentication, including fingerprint verification; PhotoKit for better performance handling photos; new Camera APIS for better control over camera focus, while balance and exposure; CloudKit, for back-end server code; App Store enhancements; Handoff, for letting users start an activity on one device and finish it on another; and app extensions for functions such as sharing content, editing photos, creating custom actions and more.

Using a Playground with Swift
[Click on image for larger view.] Using a Playground with Swift (source: Apple Inc.)

Swift, the new programming language, was designed to combine the performance of compiled languages with the simplicity of scripting languages. "By design, Swift helps developers write safer and more reliable code by eliminating entire categories of common programming errors, and coexists with Objective-C code, so developers can easily integrate Swift into their existing apps," Apple said. "Xcode Playgrounds make writing Swift code incredibly interactive by instantly displaying the output of Swift code."

Apple said Swift was designed with security in mind and can eliminate classes of unsafe code. "Variables are always initialized before use, arrays and integers are checked for overflow, and memory is managed automatically," Apple said. "Syntax is tuned to make it easy to define your intent -- for example, simple three-character keywords define a variable (var) or constant (let)."

In designing the new language, Apple said it consulted the latest research on programming languages and combined that information with its own experience building apps for its own platforms.

"Named parameters brought forward from Objective-C are expressed in a clean syntax that makes APIs in Swift even easier to read and maintain," the company said. "Inferred types make code cleaner and less prone to mistakes, while modules eliminate headers and provide namespaces. Memory is managed automatically, and you don't even need to type semi-colons."

Besides showing the instant result of code changes, the Xcode Playgrounds even let developers use a timeline assistant to track a program's execution through loops, displaying variables, drawing each step while composing views and playing animated SpriteKit scenes.

Apple said Swift also features: closures unified with function pointers; tuples and multiple return values; generics; fast, concise iterations over ranges or collections; structs that support methods, extensions and protocols; and functional programming patterns, such as map and filter.

Swift is available as a beta download for developers who are enrolled in Apple's developer program, which costs $99 per year.

About the Author

David Ramel is an editor and writer at Converge 360.