Interested in learning what's next for the gaming industry? Join gaming executives to discuss emerging parts of the industry this October at GamesBeat Summit Next. Learn more.
HomeKit, macOS, and tvOS weren’t the only platforms that Apple touched on during its 2019 WorldWide Developer Conference in San Jose. Today, it announced SwiftUI, a framework that complements its open source compiled programming language for iOS, macOS, watchOS, tvOS, Linux, and other platforms alongside a reimagined development experience in Xcode 11.
SwiftUI lets developers specify UI with simple declarations. In practice, it reduces hundreds of lines of code to just a few, and it provides default support for common features like localization for right-to-left languages. That’s in addition to built-in support for animated transitions, live previews, and the newly announced dark mode and accessibility tools in iOS.
Apple says it’s fully integrated with the aforementioned Xcode development experience and native frameworks for Apple Watch, tvOS, and macOS apps. Within the new Xcode, speaking of, library views live in a left-side drawer from which they can be dragged and dropped onto the app design canvas; as they’re added, code populates the editor on the left. Meanwhile, views can be adjusted with custom-tailored inspectors or the code converted into a scalable list, and previews can run directly on connected Apple devices, including iPhone, iPad, iPod touch, Apple Watch, and Apple TV.
“SwiftUI is available across all of our platforms, and it provides bindings to all the native controls so you can customize your experiences specifically for each, all while using a common API,” said senior vice president of software engineering Craig Federighi onstage.
Swift, which Apple introduced in 2014 and open-sourced in 2015, uses the Objective-C runtime library and works in Xcode and its Cocoa and Coca Touch frameworks. It’s positioned as the “successor” to C and Objective-C, the dominant languages used to write software for OS X and iOS; Apple has previously described it as “a replacement for C-based languages (C, C++, and Objective-C).”
In 2016, Apple launched Swift Playgrounds, an iPad app featuring interactive puzzles, challenges, and lessons designed to teach beginner programmers how to code. Last year, it gained a sharing feature that allows users to share their creations, support for robots like IBM’s TJBot, and augmented reality (AR) lessons and modules.
More than 450,000 apps have been written in Swift to date, up from 350,000 this same time a year ago. Last year, CEO Tim Cook called it the “fastest-growing programming language out there.”
Swift 5, which was made generally available earlier this year, is source compatible with Swift 4, Swift 4.,1 and Swift 4.2, and Xcode 10.2 has a code migrator that can automatically handle some of the necessary source changes. Official binaries for Ubuntu 18.04, Ubuntu 16.04, and Ubuntu 14.04 are available for download, as well as a toolchain, and Apple has released an updated version of the Swift Programming Language guide on Swift.org.
The latest version of Swift Playground, Apple’s iPad coding tool for students, launched in beta in March: Swift Playgrounds 3.0. It adds a new source editor tab, and allows Playground Books to hold “directories of Swift code and resources that can be imported for use by any page in that book.”