Thanks to Tina for providing us all with the following, latest updates from WWDC! Get your Apple Watch fix below.

Outwarians at WWDC

These notes are a summary of multiple Apple Watch related sessions throughout the first three days of WWDC. We are very excited that Apple has finally released native watchOS, together with many new interesting features. This means we are now able to be more innovative and creative with our watch apps.

What’s new in WatchOS 2?

Architecture

In the first watchOS, the watch only contains WatchKitApp which is the UI part of the application and all logic is in WatchKitExtension which is located in the main iOS application. In watchOS 2, WatchKitExtensionmoves over to run natively on the watch, so now it contains both WatchKitApp and WatchKitExtension. The watch can communicate with the iOS app via WatchConnectivity framework. In addition, it can talk directly to the web services using NSURLSession. This means that the watch app still work even your iPhone is not presented or out of range!

3 Brand New Frameworks

  1. WatchKit
  2. WatchConnectivity
  3. ClockKit

Complications

Developers can now make their own complications which are displyed on the watch faces. A complication is a customisable widget on your watch face.

Time Travel

Apple has introduced new feature which is called Time Travel which lets you speed forward in time by rotating the digital crown. You will be able to see what is coming in the day, including your watch battery percentage.

Media Playback + Audio Recording

Apple now supports media playback and audio recording. It can play

  • Videos through WKInterfaceMovie
    • which give a full screen video standard appearance.
    • The video content can be stored locally or remotely.
    • Good to playback short contents.
  • Long-form audio
    • Suitable for playback long form audio, such as, Podcasts or music.
    • Media is playing in background.

Haptic

Apple took a watch experience to another level with Taptic Engine. Users will come to know a feeling and sound of each individual haptic and what it means in the context of the application. They now can be delivered information without having to raise their wrist. To play Haptic, you can simply callWKInterfaceDevice.currentDevice().playHaptic(.click).

Security

In watchOS2, you now can store user sensitive data in Keychain which is now made available on the watch. You can make the data available only when the device is unlock and when the user lower their wrist, the data will become unavailable.

How to migrate from watchOS 1 to watchOS 2

If you have already started developing watchOS 1 and want to migrate to watchOS 2. Apple has provides a detailed guideline which can be found here.

For more in-depth information, checkout WatchKit in-depth part 1 and part 2.

P.S. We finally got to meet meet the legendary Kent (Outwarian Alumni)!

 

Outwarians at AltConf

Outwarians Jeames, Mahmudul, Tina and Tom (L-R) at WWDC AltConf where Mahmudul presented a talk on ResearchKit, ‘Less data, more research’.

Jeames gives us his update on all the latest news from WWDC Day 2 below:

CocoaTouch / UIKit

Multitasking

The new multitasking in iOS 9 on iPad allows 2 apps to run at the same time. The layout engine uses size classes to handle resizing your iPad app to work while in multitasking.

This means that when your app is in side-bar mode or split screen mode it uses a compact width (Similar to an iPhone application) to layout its views. This means for apps using size classes and that work on iPhone, this should be an incredibly straightforward process.

There is also a new picture in picture mode for apps that play video. This means you can watch your video on screen (move it around and resize) while using other apps. There are some new APIs for handling this.

UIStackView

A new UI component! The UIStackView is a sort of “flow” layout similar to that on the apple watch. You add components to it and they are automatically stacked vertically or horizontally. The UIStackView handles all of the constraints for you, and you can adjust the spacing and alignment as you wish. It fully supports nesting (Unlike UITableView!) which means you can create complex interfaces using stack views.

Keyboard Assistant

iOS 9 adds a bar of assistant items above the keyboard alongside the word suggestions. These are customisable by apps creating a standard way to handle extra keyboard buttons in your app.

Storyboards

Linking! You can now move sections of your storyboard into separate files and link them via storyboard references. This should be great for complex storyboards that previously were large and unwieldy.

You can also now unwind segues via storyboards.

Touch Prediction

iOS now provides a built in touch prediction API, which will provide you with the predicted future location of the users touch, to allow smooth and responsive interactions.

Notification Text Input

Allow text input from users with a custom push notification. You can use this for a custom reply to a message, or any quick text input directly on the notification without opening your app.

 

Objective-C+Swift

Apple has included some great changes to objective-c to facilitate usage with swift, but I think these changes are really great for the language even without the swift compatibility. Video available here.

Nullability Specifiers

This was introduced in an earlier version of swift, but I strongly recommend that everyone use this in their Objective-C applications. Being clear and explicit of where a null value makes sense in your API is an incredibly powerful tool, and helps the compiler to pick up errors as you write them, instead of once it crashes.

We have already started using these on CabFare and find them incredibly useful!

Typed Collections allows you to specify the types allowed in your collection types, giving a sort of static type safety to objective c. eg.

NSArray<UIView *> subviews

We now know that this is a collection of UIViews, and if we try and put something else in there, it will show us a warning at compile time.

KindOf types

When using typed collections, KindOf types allow implicit downcasting of types where needed.

Code Snippet of KindOf Types

Here we are specifying that subviews elements will always be a UIView, or a subclass of UIView. Here we can call the setTitle method of UIButton without explicitly casting. This allows more explicit type information throughout your app, instead of relying on id which could be anything!

Swift 2

The Swift language has been updated with some great new language features and tooling with version 2.0. Video available here.

Guard Statement

A powerful way of explicitly handling edge cases in your functions, that works really well with Swifts if-let syntax. eg.

Code snippet for Guard Statement

guards  can be used with any condition, but also allows for optionals unwrapped with let to stay around for the rest of your method.

Defer Statement

The defer statement will ensure that the code inside will be executed at the end of the current scope. eg.

Code snippet for Defer Statement

This will ensure that doAThing() always runs at the end of the current scope, no matter where it exits. This is great for making sure clean up operations happen after throwing errors or exiting early from a function.

Error Handling

We all love to hate NSErrors and the pattern of passing references to them around our code. Swift 2 introduces a new paradigm for handling errors which is baked into the language, making writing code that can fail much cleaner and easier.

Here’s a small example of what the code looks like, see the session for a more in depth example of how it works.

C

The error handling employs an ErrorType protocol (Which NSObject conforms to), so you can create your own errors by implementing this.

Note that this is not like exceptions in java. You can’t throw an error from anywhere, it must be explicitly marked as throws to allow the function to do this. This makes Swift error handling much easier to debug, and much more performant.

API Availability Checking

Checking for system versions is now super easy in swift.

#available(OSversion) can be used to switch out code based on the users device.

As an added bonus, the compiler will now show a warning if you try and use features and are unavailable for your current deployment target.

Protocol Extensions

You can now extend protocols with functions! For example you may want to add a method that can be used on any collection type like array, dictionary etc. The example given in the session is adding a countIf method for conditional counting.

This functionality also allows many previously global functions such as map and filter to be chained with much clearer semantics. eg.

Code Snippet for Protocol Extensions

Xcode

Xcode support for swift has been greatly increased as well, with a bunch of new warnings and features in the editor for developing in the language.

 

 

Tina and Jeames at WWDC

With five Outwarians on the ground at WWDC this year, we’re really excited to share updates from Day 1. Most notably, that two of our developers, Tina and Jeames, made it onto the WWDC website!

We also had a small camp out in the Richmond office, with Jet, Adam and Rick calling out the most exciting updates as:

  • Swift being made open source in late 2015
  • Multi-tasking on iPad using a split screen, making the iPad a better productivity tool
  • Native watchOS apps
  • Enhanced intelligence, e.g. smarter Siri & Spotlight, able to guess who’s calling you from an unknown number

The following update is from our Senior iOS Developer, Mahmudul Alam, who is attending WWDC.

Native Watch App

As expected, apple announces support for a native watch app and introduces watchOS 2. WatchKit extension moves to the watch and watch apps can work without the phone being present. Watch OS comes with heaps of new features:
  • Watch connectivity framework
  • Watch extension can talk to web service directly
  • Animation support
  • Audio and video playback support on watch
  • API access to accelerometer and HealthKit sensor data
  • API access to Taptic engine.
  • In addition to glances and notification, introduces complications. Complications are glanceable custom information like upcoming flights or sports score.
  • API to access the digital crown
  • High priority push notifications to push immediate updates to watch apps.
 
XCode 7 and iOS9
 
On demand resource API:
  • Assets need not be in the app bundle, can be downloaded and used on demand
  • Customisable download order and priority
  • Resources will be hosted by app store
Storyboard refactoring:
  • Subsections of a storyboard can be extracted into another storyboard and replaced by a storyboard reference in the original one
App transport security:
  • Built into NSURLSession
  • Auto enforces current state of the art security standard (TLS 1.2, forward secrecy)
Test support:
  • API and network performance test support
  • Native UI test support
  • Native support for code coverage (unit tests and UI tests)
  • Recording UI  tests to generate tests with nearly zero coding effort
  • Supports all these feature on both Objective-C and Swift
Instruments:
  • Core location profiling
  • App transitions and network calls profiling
  • Address sanitiser – helps diagnose and fix memory issues
Crash analysis:
  • Get crash logs from both test flight and app store builds Open crash logs directly into the line of code causing issue.
… and a lot more to come! Watch this space for more updates from Day 2!