watch OS2 and iOS 9 for Xamarin developers

Now that iOS 9, watchOS2—and the iPhone 6S—are available to the public, developers can leverage their new features. Xamarin, as with previous releases, published a zero-day support for iOS9 (watchOS2 is still in preview since it requires a deployment in BitCode).

There’s a ton of new features for both iOS9 and watchOS2 and a Sinofsky-long post would be required to cover all of them. I will focus on my 3 favourites features or APIs for each platform.

iOS9 – New Search APIs

With the proliferation of apps, a lot of users are using the search screen to find and launch apps that reside in secondary home screens. Apple offers 3 ways for the developer to expose data for the Search results:

NSUserActivity which is the component used by the handoff API to transmit data related to current activities between iOS devices. Those activities can now be indexed (privately and publicly) and be available for the Search API

Core Spotlight provide a database-like API to index private content

WebMarkup which will expose web content to the Applebot crawler with deep linking information so the user can view the content directly in the app

iOS9 – Force Touch (or 3D Touch)

First available on the Apple Watch, Force Touch (or 3D Touch on the iPhone) is a new pressure-based gesture. The developer will have access to:

The raw API (Pressure Sensitivity) to react to hard or light touch on the screen

Peek and Pop to have a preview of the content without navigating (“popping” into it if desired), the peek can provide quick actions if the user swipe up or left

Picture1-172x300

Home Screen Quick Actions provide a short cut to app-specific actions when pressing the app’s home icon

Picture2-177x300

iOS 9 – Stack View

Having a .NET background, I had the pleasure to spend some time in XAML and enjoyed the StackPanel. It was sorely missed since I began to work with iOS (Android has a LinearLayout similar to the StackPanel). Auto-layout is a nice if complicated layout system but it lacked a simple stacking control. Enters the new UIStackView! With it you can control the alignment, spacing and distribution of the subviews.

Picture3-300x211

watchOS2 – Going Native, we got getters!

Like with the initial release of the iPhone which was missing a native SDK but got one a few months later in 2008, the first iteration of the watchOS SDK was, hum, limited. The apps were only extensions of the device package and ran on it, and even if you could set a property you were not able to get the value… But with OS2 the app code will be executed on the Watch. The first and immediate impact is the possibility to run an app without the paired iPhone. And with tether-less Wi-Fi, the user has access to features like iMessage. For the developer it’s almost transparent, and now you can use NSUrlSession to access remote data directly.

Picture4-300x277

watchOS2 – Complications and Time Travel

It’s not a secret that on mobile device the “real estate” is scarce. The screen size is forcing us, developers, to be more selective about what to show to the user. So it’s not a surprise that, on the Apple Watch, presence on the Face was a very anticipated feature. The new ClockKit API is here to fill this gap.

You can add a new complication, i.e. a widget on the Face with various sizes, shapes and templates (text-only or text with image, large or small, rectangular or circular) depending of the type of Face selected by the user. Your complication can support Time Travel which enables the user to view the data in the past or future.

Picture5-300x174

watchOS2 – WatchConnectivity & Communication

The network API on the original watchOS was limited: since the extension was running on the iPhone, the watch app needed the device to access the Internet and communication with the main app went through a shared storage.

Developer can use the NSUrlSession to access a remote network directly. Handoff can support the communication to transmit an URL to others iOS devices.

Most importantly WatchConnectivity is a new framework that handles communication with your iOS app. Based on a new object (WCSession) it will enable background and foreground communication with the main app to send and receive a file or a message synchronously or asynchronously.

Recent Posts

Leave a Comment