The Platforms State of the Union at WWDC is a great way to learn about some of the new features available to you as an iOS developer as well as improvements to Xcode that’ll make your life better. But it clocks in at nearly two hours, so if you don’t have that much time to spare, read on for the summary. We’ll hit the high points of the Platforms State of the Union, focusing on the parts that are relevant to you as an iOS developer, ignoring the parts about watchOS 3, macOS Sierra, and tvOS.
There’s now an App Store for iMessage apps, so if you’re interested in building iMessage apps, you can choose between creating a stickers app (which only contains images the user can send or stick on messages) or a full extension that the user can interact with. Creating a stickers app is super simple and requires absolutely no coding; you just create a project in Xcode and drop in the sticker images and app icon. Extensions use UIKit and the new Messages framework. To make debugging easier, the iOS Simulator now has a special version of Messages for apps so you can see both sides of the conversation.
One of the cool things they mentioned was that you can build collaborative editing right into your iMessage app. This sounds great for users; rather than editing and sending documents back & forth, they can just collaboratively edit a single document right inside Messages using your app.
If you want to have your app integrate with Siri, SiriKit is your new best friend. There are new terms to learn: speech is turned into intents which are turned into actions which have a response; your app is responsible for specifying the vocabulary that your app and your user will use.
Siri Apps have to fit in one of the following categories, at least for iOS 10. Let’s hope Apple expands this list in later versions of iOS:
- Ride booking
- Photo search
- VoIP calling
- Climate and radio (for CarPlay)
iOS 10 Notifications
Notifications get some serious improvements in iOS 10, giving developers the ability to embed attachments for audio, images, or video to display right inside the notification. They also support end-to-end encryption as well as
embedded attachments: audio, image, or video to display. And finally, you can now include a dynamic content extension that shows any view you create that the user can also interact with. For example, you can show the user a map view that updates in real time or a messages view that tells the user that someone is typing.
Before we get into changes in Swift 3, three fun facts:
- over 100K apps now use Swift
- Swift is the #1 downloaded, watched, and favorited language on GitHub
- Swift has been ported to Linux, FreeBSD, Raspberry Pi, Android, and Windows
It’s a great time to be a Swift developer; 100K apps seems like a ton, and it’s cool that skills in Swift now transfer to a variety of platforms. The idea that you can currently write the back end for your app in Swift is awesome, and while I would hesitate to do it today for a critical app, I’m convinced that server-side Swift will be a reliable choice in the near future.
Swift 3 brings some source changes that are going to cause existing Swift apps to break (though I’m hopeful that Xcode’s migration tool will be effective at automatically converting code from Swift 2 to 3). But why break things now? The team is focusing on source stability going forward, so there are going to be a lot of breaking changes from Swift 2 to 3 in the hope that there will be minimal breaking changes in the future.
These source code changes are removing a bunch of the verbosity and repetition required in Swift 2. Here’s one example:
content = text.stringByTrimmingCharactersInSet(NSCharacterSet.newlineCharacterSet())
See how we’re repeating the word “character” and “set” multiple times? Check it out in Swift 3:
content = text.trimmingCharacters(in: .newlines)
Notice how all the repetition of the word “character” is removed as well as all the terms about the type (“set”). Additionally, APIs like Grand Central Dispatch are being updated for Swift 3.
Swift 3 will be available in Xcode 8 with a migration tool; additionally, you’ll still be able to use Swift 2.3 in Xcode 8 so you can make the transition when you’re ready.
Swift Playgrounds for iPad
While Swift Playgrounds seems like a great way to learn Swift, it also looks like a great way to try out new things right on your device. The entire iOS SDK is available in the app, so you can try out some of the awesome new features in iOS 10 right inside the Swift Playgrounds app, then export your code and pull it into Xcode. This is the real iOS SDK and real Swift code, so this means you can quickly prototype on your iPad then send it to Xcode when you’re ready to add it to your app.
The Swift Playgrounds app is completely designed for touch input, so you can type full lines of code without using the keyboard (by using the suggestions bar), drag to change the scope of loops, or tap a number to bring up the number pad to change its value. It has a split screen view so your code can be on one half while your app runs on the other, or you can make either your code or your app full screen.
I’m looking forward to using Swift Playgrounds to prototype new ideas right on my iPad.
The latest version of Xcode has some new features that should make things much nicer for development. It can now highlight the active line and show color and image literals in Swift. Additionally, Xcode can generate documentation for you to make it easier to comment your code. (I’ve been using a plugin for this; I’m looking forward to having this as a feature of Xcode.)
Another big new feature is that Xcode now supports App Extensions that can be distributed via the App Store or signed with an Apple Developer ID. Currently this is just for Source Editing, but I’m hopeful that we’ll get great new third-party tools for code formatting and refactoring to make development easier.
Apple has improved the API Reference that’s included with Xcode by showing SDK availability as well as allowing you to switch between Swift or Objective-C documentation.
Interface Builder has gotten a bunch of new improvements, most of which are around seeing how your interface will render on a real device. You can choose different devices, orientations, and adaptations right inside Interface Builder now, which should make it easier to verify that your app will always look the way it should. Additionally, IB now lets you edit at any zoom level. ??
Runtime issues such as race conditions, ambiguous layouts, and leaks can be automatically identified by the debugger in Xcode 8. These show up in three areas: the new Thread Sanitizer, the updated View Debugger, and the new Memory Debugger. I’m looking forward to having more help from Xcode in debugging these types of issues.
I was surprised to hear Apple acknowledge that code signing is a super frustrating issue. To address this, Xcode 8 will have better code signing and device setup; it’ll automatically generate a unique development certificate for each Mac you own, which is great if you have just one Mac and even better if you have multiple. It will also provide actionable messages and a provisioning report. Additionally:
Developing and running your app on your Apple device is as easy as entering your Apple ID into Xcode preferences. Apple Developer Program membership is not required.
Finally, Xcode 8 gets serious performance improvements for things like launching Xcode, indexing tests, playground execution, source control with git, and more. This should make development much nicer if you’re like me and don’t enjoy waiting around for things to happen.
Where to go next
Watch the Platforms State of the Union video or flip through the slides to learn more about these plus watchOS 3, macOS, tvOS, and more on Apple’s site.