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
orUIImage
. - 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
- There’s now
NSDateInterval
for counting the duration of a time interval, checking whether a date exists in a range, and comparing intervals. - FINALLY an ISO 8601 date formatter.
NSPersonNameComponentsFormatter
has a newpersonNameComponentsFromString:
method that can parse out the individual components of a person’s name.
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 asUILocalNotification
itself) are now deprecated in favour of theUserNotifications
framework.
UIKit
- There’s a load of new animation APIs: “New object-based, fully interactive and interruptible animation support that lets you retain control of your animations and link them with gesture-based interactions.”
- The refresh control is now supported in all scroll views and scrollview subclasses thanks to
UIRefreshControlHosting
. - Collectionviews and tableviews support prefetching of cells to improve scrolling (
UICollectionViewDataSourcePrefetching
andUITableViewDataSourcePrefetching
) - It looks like you can now provide your own previewing UI for 3D Touch:
UIPreviewInteraction
. - There are new UIVisualEffectView blur types: prominent and regular.
Core Data
NSPersistentContainer
looks like it might replace the simpleCoreDataStack
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 anautomaticallyMergesChangesFromParent
property to do theNSManagedObjectContextDidSaveNotification
observation and merging automatically.
Swift Playgrounds
- On iPad,
XCPlayground
is replaced byPlaygroundSupport
. - 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.