WWDC 2016 Developer Tidbits

A collection of some of the smaller Xcode, iOS, and watchOS changes I’ve come across whilst reading Apple’s updated developer documentation during WWDC.

There were some nice announcements from Apple at WWDC yesterday, including a revamped lock screen and notifications for iOS, SiriKit, and a lot of iMessage integration. Whilst scouring the newly-released developer documentation I’ve come across a lot of interesting tidbits that aren’t headline features on their own, so I thought I’d collect them here in case they’re of use to anyone else. In no particular order:

Xcode

  • Some nice improvements to Interface Builder. You can now edit your UI at any zoom level (FINALLY)! The UI for customizing layouts for different device traits has also been revamped, and looks really good.
  • Image and colour literals are now supported in Swift code, including code completion for images that’re in your asset catalog. Simply start typing either color or UIImage.
  • There’s a new monospaced code font in Xcode: SF Mono that seems to match up with the WWDC promo material this year.
  • The simulator features a special version of the Messages app which allows you to see both halves of a conversation between two users. Very useful for testing all the iMessage newness.
  • Xcode 8 supports both Swift 2.3 and Swift 3. If you choose Swift 2.3 for a project, there’s a new build setting that gets set to Yes: “Use Legacy Swift Language Version”.
  • The new memory debugger looks incredible. You can visualize the current object graph, and it can help identify memory leaks / retain cycles.
  • Xcode now highlights the active line when editing.

Foundation

Notifications

  • The User Notifications UI framework lets you customize the appearance of local and remote notifications when they appear on the user’s device.
  • You can also intercept push notifications (through UserNotifications.framework) and handle them before they alert the user. For example, you could download a video and then tell the user it’s ready.
  • Rich notifications are currently only optimized for 3D Touch, and they’ll be providing access to functionality for users of other iPhone models / iPad at a later date.
  • A lot of the existing remote and local notification methods on UIApplication (as well as UILocalNotification itself) are now deprecated in favour of the UserNotifications framework.

UIKit

Core Data

  • NSPersistentContainer looks like it might replace the simple CoreDataStack class I’d add to most new projects. It encapsulates the whole core data stack, and has convenience methods for creating new background contexts and performing background tasks.
  • NSManagedObject gets a few new methods – init(context:), fetchRequest(), entity().
  • Xcode should be able to automatically generate classes for Core Data entities, but I’ve been unable to get this to work so far.
  • NSManagedObjectContext now has an automaticallyMergesChangesFromParent property to do the NSManagedObjectContextDidSaveNotification observation and merging automatically.

Swift Playgrounds

  • On iPad, XCPlayground is replaced by PlaygroundSupport.
  • You can record videos of coding sessions right inside the app (in the Share menu).

watchOS

  • Glances have gone completely in watchOS 3. Your app should now display and update glanceable information when the user has it in their Dock.
  • If the user has your complication on their watch face, your app will be kept in a ready-to-launch state.
  • WKCrownSequencer lets you directly access information about the crown’s state – whether it’s rotating, how fast, and when it’s stopped.
  • SpriteKit and SceneKit on the watch is cray-cray. The State of the Union contains a cool demo where a notification on the watch contains an animated 3D SceneKit scene.
  • You can now access information about the watch’s orientation, crown position, wrist location, etc in WKInterfaceDevice
  • If you’re using a watch app, whenever you lower and raise your wrist, you’ll get taken right back into the app, for up to 8 minutes.

SiriKit

  • SiriKit is limited to only certain domains:
  • Audio or video calling
  • Messaging
  • Sending or receiving payments
  • Searching photos
  • Booking a ride
  • Managing workouts

Misc

  • If you’ve indexed content for your app with Core Spotlight, you can now search it programmatically in-app using CSSearchQuery. A user can also continue a Spotlight search inside your app.
  • Speech recognition is now possible, through the Speech framework and SFSpeechRecognizer.
  • You can set an expiry or exclusions for pasteboard data for the new universal clipboard.
  • iOS 10 drops support for the iPhone 4S, iPad Mini, iPads 2 and 3, and the 5th generation iPod touch.

Leave a Reply