Apple Watch and the Cross-Platform Crisis

With the March announcement of the Apple Watch, hype around the new wearable simply couldn’t be any more deafening. Couple that with Android Wear, which has been out for some time now, and you have a situation that is unavoidable: there is a new screen size and the tectonic plates of computing are shifting yet again. More disruption in a world that is already desperately trying to keep up with all of the devices, resolutions and capabilities.

If it wasn’t official before, it is unavoidable now: we have a cross-platform crisis on our hands.

This leaves JavaScript mobile developers wondering: What now? Is Hybrid/Cordova still the right way to go? What aboutNativeScript, Telerik’s new framework for building native applications with JavaScript? NativeScript can build native apps, so can it be used to build Watch apps too?

In this article, I’ll share with you what the landscape looks like for JavaScript developers working on mobile applications. I’ll also share some things Telerik is working on and give you a glimpse into a future that we’ve been aware of and thinking about for quite some time.

But before we dive into that, let me explain why the Apple Watch is actually not nearly as disruptive as you might think.

A New Resolution

Watches introduce an entirely new type of interface. These new devices with minuscule screens have sent us all back to the drawing board. Is Responsive Design now a throw-away concept? How are we going to cram this Bootstrap site onto someone’s wrist? Some are even saying that we need to rethink the format of our HTML emails since they will now be on an even smaller screen than before.

The truth is, the Apple Watch is not meant to be your primary mobile device, and that’s really good news for developers.

Think of like this: wearables largely free developers from having to worry about an interface. Right now, the Apple Watch essentially supports a very limited number of UI widgets and interactions. The iPhone was a whole different story: ListViews, TabStrips, Switches, Drawers – none of us had seen any of these things before. It was an entirely new, and in many ways it was a much more complex interface.

The Apple Watch is none of those things. It is intentionally simple and as of the time of this writing, completely dependent on the iPhone to function. Simply put, the Apple Watch is mostly about notifications. This makes your job as a developer much easier since you can focus on the function and not the form, which is where hybrid developers tend to expend a lot of energy.

Hybrid Options

Communicating between Cordova applications and the Apple Watch is possible today thanks to a plugin from Lee Crossleythat provides a message passing interface. The primary limitation at the moment for hybrid (read Cordova) developers, is that a watch interface cannot be built with Cordova since the watch does not support a WebView.

We’ve been in the hybrid game for a long time at Telerik, and we’ve been thinking about this one carefully. How can we provide Cordova developers with a mechanism for building mobile applications without excluding wearables? We think, at least for now, that the answer lies in templates.

Watch Templates for Hybrid Developers

The idea is that since the watch interface is so simple, we can provide watch interface templates out of the box. All the hybrid developer has to do then is to select which template they like. What would a template look like? We’re still defining that, but you could image some that are…

  • Label with Button
  • Label with Image
  • List of Labels
  • Image With Button

…and those are just a few. The trick is providing the right combinations so that all the developer has to do is to provide the information to the template.

By the way, if you’ve ever wondered about how Apple got that Salesforce chart on the watch during the keynote, we wrote an article about getting charts on your Apple Watch apps back in early February.

Download Source From GitHub

We’re also investigating ways to make it simple for developers to send a push notification from our Backend Services and have it seamlessly go all the way through to the watch template without the developer having to do any plumbing.

Now let’s turn our attention to NativeScript for a moment, because there are some very exciting possibilities when it comes to truly native applications built with NativeScript.

NativeScript and the Apple Watch

NativeScript is Telerik’s new open-source framework for building native mobile apps with JavaScript.

NativeScript was designed from the ground up to be extensible. The NativeScript runtime will take any native call made in JavaScript and proxy it to C++ which in turn executes the Objective-C APIs. That means that as long as your call is well formed, you can call any native method, regardless of whether or not NativeScript provides a module for it.

This is how NativeScript builds the UI. The UI is defined with markup, which is parsed by NativeScript and then the native controls are created programmatically using the proxied JavaScript-to-Native. This is a highly efficient way of creating the UI. However, Watch Apps are unique because they rely entirely on Storyboards.

Storyboards and NativeScript

Storyboards are a concept that is unique to iOS. They allow the developer to visually create the user interface and flow of an application. In a traditional iOS application, a developer could create visual elements either programmatically, or with storyboards. In a Watch Application, the only way to build the user interface is with a storyboard.

This presents a challenge, but it’s not like that’s new territory for NativeScript.

The team has already started proofing out what it takes to accommodate storyboards and extensions in NativeScript. You can see some early POCs in the NativeScript repo. In addition to supporting storyboards and extensions, the NativeScript team is also considering offering templates as well to facilitate the fastest watch development experience possible.

Thanks to the extensible nature of NativeScript, really anything goes.

Wearables = More Cross-Platform Developers

If there was a strict device policy at your place of employment, it’s destiny is now way up in the air. Wearables are the most personal computing device any of us have seen so far, and they are only going to further the mandate on developers that applications work cross-platform.

It might have been doable to write an iOS and Android app, but now an iOS app, Watch app, Android app, Android Wear app? This, my friend, does not scale.

Sooner or later we’ll be writing apps for phones, watches, glasses, toe rings and anything else we can find good reason to turn into a wearable. If you were thinking about making the switch to a cross-platform development strategy such as Hybrid or NativeScript, you can feel confident that the underlying architecture of those will support the next generation of wearable gadgets.

Header image courtesy of Apple PR

[cm_ad_changer campaign_id=11]