WWDC 2016 Initial Impressions

Chris Wagner

WWDC-16-Initial-feature

It’s the most wonderful time of the year for Apple developers!

The first day of WWDC brought lots of new APIs and features for us to dive into, including Swift 3, SiriKit, iMessage Apps, and more.

Ever since the Platforms State of the Union I’ve been diving into the docs, and I thought it would be useful to post my first impressions of all the news, from a developer’s perspective.

Feel free to post any of your own thoughts, or anything I may have missed!

Swift 3

The change from this year that will have the biggest impact on developers is the release of Swift 3 in late 2016, since it will require us to all make some major changes to our Swift code.

However, if you’ve been following along with the Swift evolution project, this really shouldn’t be a surprise. Since Swift is open source, Apple and the community have been working extremely hard on this over the past 6 months, and everything’s been discussed publicly. Nothing new was announced today, aside from one thing: Swift 3 is conveniently packaged with Xcode 8, side-by-side with Swift 2.3.

This addresses one of my biggest complaints from last year, where we were unable to use Xcode 7 unless we also migrated our source code to Swift 2. But since Xcode 8 ships with both Swift 2.3 (which is source code compatible with Swift 2.2), you can now bring your Swift 2.2 projects over to Xcode 8 right away, and you can wait to upgrade to Swift 3 until you’re ready.

In case you haven’t been following the Swift 3 discussion, we’ll be releasing a full post on What’s New with Swift 3 tomorrow. In the meantime, I did want to mention one thing in particular that will affect all of us.

Swiftier Objective-C APIs

One of the biggest changes coming with Swift 3 is that Apple is giving a massive face-lift to its APIs to make them more “swifty”.

It’s easiest to understand this by looking at a few examples. Here’s an example of working with strings:

// Swift 2.2
let content = listItemView.text.stringByTrimmingCharactersInSet(
    NSCharacterSet.whitespaceAndNewlineCharacterSet())

// Swift 3
let content = listItemView.text.trimming(.whitespaceAndNewlines)

Note how the Swift 3 version is much more concise, and makes use of an enum.

And here’s an example of working with Core Graphics:

// Swift 2.2
let context = UIGraphicsGetCurrentContext()
CGContextMoveToPoint(context, 5, 0)
CGContextAddLineToPoint(context, 10, 10)
CGContextAddLineToPoint(context, 0, 10)
CGContextClosePath(context)

// Swift 3
let context = UIGraphicsGetCurrentContext()!
context.moveTo(x: 5, y: 0)
context.addLineTo(x: 10, y: 10)
context.addLineTo(x: 0, y: 10)
context.closePath()

Note the switch from global C functions to handy methods on the context.

And finally, here’s an example of using GCD with a much simpler API:

// Swift 2.2
let queue = dispatch_queue_create("myqueue", nil)
dispatch_async(queue) { 
  // do stuff
}

// Swift 3
let queue = DispatchQueue(label: "myqueue")
queue.async { 
  // do stuff
}

As you can see, the goal is to reduce verbosity in naming in favor of terse yet expressive code; and moving away from globally defined functions in favor of members of respective types.

The changes here are going to take some getting used to for seasoned developers, but in the long run it will make the language cleaner and more approachable to new developers. Also, Xcode 8 ships with a migration tool to convert your existing code to Swift 3, which should make things much easier.

I am really excited to see these changes because ultimately the new APIs feel much more intuitive than they do today.

Note: To learn more, check out Apple’s API Design Guidelines and Better Translation of Objective-C APIs into Swift.

Swift Playgrounds on the iPad

Ever since the release of the iPad Pro, developers have been anticipating Xcode for the iPad.

We didn’t quite get that, but we did get a step in that direction with the announcement of Swift Playgrounds for the iPad. It’s similar to the Playgrounds we already know and love, but it also has a nice custom keyboard and UI for easily creating code, and some nice built-in tutorials for beginners.

It looks to be particularly well suited for teaching people Swift as their first programming language, but I can also see it being handy for experienced developers looking to prototype some code on the go.

Xcode 8

rayroll-square

It wouldn’t be WWDC without a major update to Xcode!

Here are some of the top highlights for me so far.

Memory Debugger

One of the coolest new features for me was Xcode 8’s new memory debugger.

This is a built-in tool that lets you view the entire memory object graph of your running application, so you can quickly isolate leaks and circular references. As soon as you spot them in the graph you can select it, view that frame’s stack and jump straight to the line of code causing the issue. Simply brilliant!

Even more, the new memory debugger can automatically detect memory leaks and help you quickly diagnose the problem. The demo was beyond impressive and drew massive applause from the audience. Goodbye, retain cycles!

Interface Builder Improvements

Have you ever tried zooming out in Interface Builder, then tried to drag in a button, and realized that you couldn’t unless you were at 100% zoom level?

Well, those days are no more! Interface Builder in Xcode 8 now allows you to edit your scenes at any zoom level.

It also comes with a handy new configuration bar that allows you to easily preview your view controller sized for different devices and size classes (iPhone, iPad, etc), and identify ambiguous layout constraints before you ever build and run. This is going to be such a time saver for users of Interface Builder.

Source Code Editing

Xcode 8 improves on the source editor by autocompleting image assets in your project with a preview of the image itself, right in line with your code!

xcode8-image-literal

You achieve this by typing the name of your image and a non-optional UIImage instance is returned.

In addition, Xcode 8 can display colors right in line for literal definitions:

xcode8-color-literal

You achieve this by typing color into the editor and choosing the “Swift Color Literal” option which will bring up a color picker.

You can also create your own Source Code Editor Extensions to customize the coding experience. There is a new Xcode template to get started with, and when you’re finished you can distribute your extensions via the Mac App Store or as a Developer ID signed binary through any other medium. I am looking forward to seeing what you all develop!

Performance Improvements

Apple claims that Xcode 8 is radically faster in several categories – for example Indexing Tests can be up to 50 times faster.

Speed improvements leads directly to more productivity as developers, so this is great news!

iOS 10 SDK

The iOS 10 SDK adds a number of new kits, extension points, and enhancements to existing frameworks. Below is a small pickings of the ones that stood out to me.

SiriKit

Arguably the most long awaited developer feature is the ability to integrate with Siri. Now you can in iOS 10 with SiriKit!

SiriKit defines six distinct domains that your app can use to make services available to Siri:

  • Audio or Video calling
  • Messaging
  • Sending or receiving payments
  • Searching photos
  • Booking a ride
  • Managing workouts

If your app falls into one of the domains listed above, you should provide an Intents Extension point within your app. Siri deals with all of the nuances of language processing and semantic analysis, and translates the user’s request into an actionable item that you handle in your Intents Extension. You can opt to provide custom UI as necessary when your app is passed an Intent from Siri or Maps.

There are a number of details that your extension must provide in order for the system to determine that your app can handle a user’s request, but if you are familiar developing App Extensions that were introduced with iOS 8 you will be on your way to creating a Siri extension in no time.

Note: To learn more, check out the SiriKit Programming Guide.

iMessage Apps

As a Slack and Facebook Messenger user, I am super excited about the enhancements to messages. Animated GIFs and fireworks, here I come! :]

In the keynote, Apple demonstrated a ton of cool new features like link/media unfurling, reactions, message bubble effects and even window effects that I don’t quite understand how to create yet. As the demos went on, I kept hoping that they’d announce an extension to allow third party developers into the messaging platform, and they did! With the new Messages framework you can create extensions that let users send text, stickers, media, files and most intriguing: interactive messages.

Sticker Packs

The simplest type of extension is sticker packs. These are ridiculously easy to build and allow you to define a set of stickers that a user can use to send to their friends. If you’re at all familiar with Facebook Messenger it looks very similar, except that stickers can be “peeled” and placed on top of other messages. Honestly, it’s a bit gimmicky, but should still be very entertaining. :]

Interactive Experiences

You can go a lot farther than sticker packs though. The APIs allow you to create entire experiences right within the Messages app, even providing a custom user interface! This is obviously interesting for services like Giphy, where providing such an extension may have a better experience than what their third party keyboard does today. But it may also be extremely powerful in business contexts as well.

Consider a service company who has a fleet of techs that use Messages to communicate. It might be useful for them to have access to data from their customer management system right within messages to get information back and forth to each other quickly. And with interactive messages each party can “build” upon a message. The Keynote demo that was given was creating a group food order where each person on the group chat could modify the food order before it was sent.

There are a ton of apps I can foresee benefiting from this and I am excited from a user’s perspective to see where it goes.

Note: To learn more, check out the Messages Framework Reference.

User Notifications

A new UserNotificationsUI framework has been introduced which allows developers to create rich notifications that were never possible before.

For example, notifications can now have embedded media much like the stock Messages app. This appears to involve an intermediate server between your app and APNS but it is achieved through a new extension that is invoked when a notification is received and looks to be extremely powerful. You can even provide your own layer of end-to-end encryption features through the use of the intermediate server notification extension.

I haven’t had time to look into this much yet, but look forward to more details on notification enhancement as the sessions play out and also check out the UserNotifications framework reference.

Widget Overhaul

Widgets are getting a big overhaul in iOS 10 and I am glad to see it. I was originally pretty excited for widgets in iOS 8, but as it turned out they just weren’t that great living in the Notification Center.

Now, widgets live to the left of your home screen kind of like how they used to be on macOS. Widgets can also appear with your 3D Touch Quick Actions on above/below your app icon. This is a much more natural place to look for quick information in my opinion, it’s almost as if you’re peeking into the app’s content.

watchOS 3

It’s a common opinion that the Apple Watch platform has been a bit of a flop with regards app development. Although it’s a very fascinating device and is pretty good at its core functionality, it has been missing something since the beginning: speed.

Launching apps on the watch is simply painful. Often you’re met with a spinner that goes on and on for 20-30 seconds and even sometimes bails out completely, leaving you frustrated and confused. Eventually you find yourself stashing your watch in a drawer, selling it, or like me wearing it simply as a time piece and notification viewer.

When Kevin Lynch opened the keynote by saying that their main focus was making apps launch instantly, I was pretty excited! If this pans out to be truth, this makes me believe that watchOS development will be great again. :]

Speed Enhancements

The big things behind the speed enhancements of the watch are the introduction of Snapshots, the Dock, and Background Tasks. The three of these combined allow watch apps to stay up to date and available to the user at a moment’s notice.

Snapshots and Background Tasks are similar are just like on iOS:

  • With Snapshots the system will take a screenshot of your UI so that it can be used when your app launches and during app switching.
  • With Background Tasks your app is given time in the background to update its information so that it is available as soon as the app is opened.

SceneKit and SpriteKit Availability

You can now utilize both SceneKit and SpriteKit in your watch apps. At first mention I thought this was just for games, but then Apple explained another use case: creating nice custom animations for regular apps.

The current limitations of UIKit on the watch prevent developers from creating custom animations. But with watchOS 3, you can add live 3D rendered content to your apps using .scn files bundled with your resources, or you can opt to create interactive 2D animations with bundled .sks files. It will be really interesting to see what developers do here!

Complication Improvements

When a user adds your complication to their watch face in watchOS 3, you gain the ability to keep your app in a ready to launch state and get a guaranteed 50 push updates per day. This is a pretty compelling reason to provide a complication if it makes sense for your app’s data. Perhaps even in some instances the complication data may not be that valuable to a user but the added benefit of faster app launch is.

tvOS 10

The updates to the tvOS SDK seem pretty light.

There is a new concept of single sign-on with TV providers so that users can authenticate with their provider once and be logged in to all supported video channel apps. So if you develop apps that need this level of authentication please check out the VideoSubscriberAccount framework!

The main items of interest for tvOS are that there are a number of existing frameworks made available to developers:

  • ExternalAccessory
  • HomeKit
  • MultipeerConnectivity
  • Photos
  • ReplayKit
  • UserNotifications

macOS

After 15 years, OS X has been renamed to macOS to better align with the other three platform names. The latest version of macOS is macOS Sierra.

I’m personally not a macOS developer, so I’m not going to dive into this much. However, I do want to highlight one feature that is particularly interesting to me.

Apple Pay for the Web

With macOS Sierra users can make purchases using Apple Pay on the web!

This is huge for any developers working on a web site with eCommerce, as it lowers the barrier of entry for a paying customer almost entirely. Imagine not having to deal with the security concerns of handling customer credit card data – and even better, the confidence your customers have knowing that their credit card information is not being stored on various web sites.

As far as I can see it there is no reason (barring legal commitments) to not add Apple Pay support to your websites. The process involves integrating an Apple Pay JavaScript framework.

Apple File System (APFS)

Last but not least, I’d like to discuss something that is relevant across all of the platforms: Apple has announced an entirely new file system!

Had I not listened to John Siracusa talk about file systems on various podcasts I would have never expected this. The improvements appear to be pretty great though!

The current file system used by default is HFS+ which was released in 1998 when floppy disks were still a thing. Today most – I am looking at you base model iMac with your 5400RPM HDD – new systems include fast Flash based SSDs. The Apple Filesystem was designed with Flash/SSD in mind and built with native encryption.

The user benefits include things like crash protection, space sharing, cloning and snapshots. Crash protection uses a copy-on-write metadata scheme which ensures that updates to the file system are crash safe and reduces the need of journaling used by HFS+. Space sharing allows multiple file systems on the same disk to share the free space available without the need to repartition the drive.

Cloning provides the ability to create instant “copies” of files and directories that cost nothing in disk space. Due to the copy-on-write behavior the cloned files and directories are not actually copied unless modifications are made. *NIX users might relate this to creating symbolic links, it’s the first thing I thought of, but I am sure there is a ton more to it. Finally, the snapshotting ability allows the system to create a read-only instance of the data so that it can be efficiently restored to a given point in time.

Where To Go From Here?

So that concludes my initial impressions of all the new goodies in store for us this year.

As I mentioned, I haven’t had a chance to look through everything yet, so I may have missed some buried gems. Please let us know if you spot anything, we’re just as excited and overwhelmed by all the new content!

In the meantime, we’ll be working hard on making some new written tutorials, video tutorials, and books in the coming weeks. Stay tuned! :]

Chris Wagner

Chris Wagner is currently working as an Independent Contractor primarily with MartianCraft focused on iOS development. Prior to this he founded and led the mobile team as Senior Software Engineer at Infusionsoft. Chris started “programming” by playing with QBASIC and the Lego Mindstorms kit (thanks Dad) at a young age. The next big thing was the web, as an avid gamer for many years (Rogue Spear, Counter-Strike, WoW) he continued to feed his passion for software development by building web sites for his gaming clan and others. After graduating with a Computer Systems Engineering degree from ASU he worked as a Java web app developer before moving on to leading multiple iOS development teams.

Other Items of Interest

Save time.
Learn more with our video courses.

raywenderlich.com Weekly

Sign up to receive the latest tutorials from raywenderlich.com each week, and receive a free epic-length tutorial as a bonus!

Advertise with Us!

PragmaConf 2016 Come check out Alt U

Our Books

Our Team

Video Team

... 20 total!

Swift Team

... 15 total!

iOS Team

... 42 total!

Android Team

... 16 total!

macOS Team

... 11 total!

Unity Team

... 11 total!

Articles Team

... 12 total!

Resident Authors Team

... 15 total!