Now that the dust has settled on another Apple World Wide Developer Conference (WWDC), it's a good time to unpack what some the announcements of the week mean. The media has done a great job of unpacking what the announcements meant for end-users for Macs, Apple Watch, iOS devices, and the Apple TV, so instead of retreading that we're going to focus on developer-related announcements and releases. Instead of trying to explore every little new developer feature, tool, and service that Apple announced, we're going to talk a little about three new things:
- Swift 3 Preview 1—the first proper release of Swift 3, the next evolution of the Swift programming language.
- Swift Playgrounds for iPad—the new live programming environment for iPad, designed for students and experimentation with Swift, and programming.
- App Review Guidelines—the revised guidelines for submitting things to the App Store.
We’ll conclude with a quick summary of the other changes and some suggestions for where to learn more.
Swift 3 Developer Preview 1
Swift is Apple’s new programming language, originally released in 2014. Swift 3 is the third major update to Swift and makes moves towards stabilizing the language syntax. It builds upon the core goals of the language: safety, speed, and expressiveness.
The first developer preview (DP) of Swift 3 is the first release of the already-announced Swift 3 release process, which will feature a number of DP releases every 4 to 6 weeks, until the last DP is declared GM.
Swift 3 DP 1 includes 41 of the Swift Evolution proposals that were proposed and accepted through the Swift Open Source Project. Some of the Swift Evolution proposals that are implemented in Swift 3 include:
- The removal of the ++ and - - operators (SE-0004): the removal of the legacy increment and decrement operators, which were originally included, inspired by C, without much thought.
- Better translation of Objective-C APIs to Swift (SE-0005), applying new API guidelines to the standard library (SE-0006), and API Design Guidelines (SE-0023): three interrelated proposals that strengthen the design of Swift APIs and improve support for Objective-C API usage from Swift.
- Generic type aliases (SE-0048): allow type aliases to introduce type parameters, which are in scope for their definition.
There's a whole lot of others though, and the list is worth perusing if you're curious. While we think that Swift 3 is a huge, substantial release, the changes from Swift 2.2 to Swift 3 DP 1 aren't as massive, syntax-wise, as the changes from Swift 1 to Swift 2 were, and the migration tools can help with the majority of it, as we'll discuss.
Where and when can I get Swift 3 Developer Preview 1?
If you're on a Mac, you can download Xcode 8 beta 1, which includes Swift 3.0 DP 1. You can expect regular betas of Xcode 8 throughout the next few months, leading up to a release of the final versions of Xcode 8 and Swift 3 in fall, towards the end of the year.
What's the best way to move code from Swift 2 to Swift 3?
First of all, you should make sure you're using the latest version of Xcode 7 (currently Xcode 7.3). Then, once you've installed Xcode 8 (currently available as Beta 1), open the project. The Swift Migration Assistant will run the first time you open the project in Xcode 8 (but you can also find it in the Edit menu, under Convert).
Following the steps in the Migration Assistant will give you a preview of the changes required to comply with Swift 3. You can then accept and apply the changes. Of course, the Migration Assistant is not perfect, and you can find tips and tricks, as well as a list of workarounds and known issues on the Swift Open Source Project website.
Swift Playgrounds for iPad
Swift Playgrounds are primarily designed for education and learning, but as they allow full access to the iOS SDK (CocoaTouch), can be used by developers for prototyping or development on an iPad. Playgrounds will be available for iPad on the iTunes App Store when iOS 10 is released to the public (in the Northern Hemisphere Fall), but is included with the iOS 10 developer preview that's available right now.
Swift Playgrounds for iPad is big news for a number of reasons, but we're most excited about it because it provides an amazing environment to learn programming—and learn Swift itself—but also to develop interactive documentation. iPads are incredibly portable, accessible, and engaging for people of all backgrounds and skills, and anything that starts to make programming more accessible is a great development.
During WWDC, Apple announced that they had revised their App Review Guidelines: the 'rules' (sort of!) that you have to abide by when submitting apps. Some of the more interesting updates to the guidelines, as well as the review process in general, include:
- Consolidating the App Review guidelines document so that now it covers all the platforms: iOS, macOS, watchOS, and tvOS
- A planned speed-up of App Review timelines, down to 2-days or so, from the possible weeks it used to take
- A note saying that Apple will revise the document to cover their new subscriptions system later this year
Apple also released their App Store Review Guidelines in comic book form, and it's available as a PDF.
A lot of developer-focused things were announced at WWDC, which is a good sign for a developer conference:
- The new OS X (now macOS) is named Sierra, and will be out in the fall. A developer preview is available now.
- iOS 10 has been announced, and will be out in the fall. A developer preview is available now, and a public beta is coming soon.
- watchOS and tvOS both received updates, with a lot of new features—particularly in the area of speeding up Apple Watch apps.
- On the Apple Watch, fitness apps can run in the background during workouts, and the SpriteKit, SceneKit, Game Center, and CloudKit APIs are now available.
- On the Apple TV, ReplayKit, PhotoKit, and HomeKit APIs are now available.
- On iOS, apps can now make better use of the MapKit, iMessage, HomeKit, and Siri.
If you want to learn to build iOS, macOS, watchOS, or tvOS apps, we recommend starting with the public version of Xcode (7.3), and Swift 2, and then moving to Xcode 8 and Swift 3 once they are released late this year.
We're fond of our own books, so we'll recommend our books Learning Swift and Swift Development for the Apple Watch, which are up-to-date with the current public release of Swift (which version 2.2). Learning Swift teaches you both Swift, as well as the Cocoa, CocoaTouch, and watchOS frameworks, for building apps for OS X (now macOS), iOS, and watchOS respectively. Swift Development for the Apple Watch teaches you how to use the various watchOS frameworks to build an app for Apple Watch. While both of these books target Swift 2.2, not Swift 3.0, the syntax changes between the two languages are minimal, and Swift 2.2 is the only version of Swift you can submit apps to the store with until the end of the year, when Swift 3 comes out. Additionally, Xcode 8, when it becomes public, will assist you in migrating your code from Swift 2.2 to Swift 3.
We also highly recommend our friend Tony Gray's, Swift Pocket Reference, which is available as a completely free eBook from O'Reilly Media.
In July, we’re also running online live training right here, with O’Reilly.