All Blog Posts

Apple Watch: The Do's and Don't's of App Development

There was a definite air of disappointment with the perceived power and capability of the Apple Watch after the keynote. There were many questions about what we could, and what we couldn’t do when we first sat down with WatchKit to start building. What I’m here to tell you is that – fear not – there’s still a lot you can do with the WatchKit SDK.

Development

apple watch in hand

TLDR:

  • The Apple Watch keynote was a let-down
  • There’s a few things you can’t do
  • There’s also lots that you can do

After two weeks of work with the Software Development Kit (SDK) and finishing off what is – under the surface – a complex app, we’ve been able to get a thorough understanding of what are the cans and cants of WatchKit are. Whether that be building a simple grocery list or trying to create a masterful AI system which will take over the world – let’s face it, as developers we like to think big.

Can't do's:

1 Make dynamic table cell layouts at runtime.

2 Make an app without Interface builder (don’t despair just yet).

3 Use core animation, or more importantly over-use spring dynamics.

4 Use any of the awesome watch features.

5 Keep the watch unlocked.

6 Force open your iOS app.

Can do's:

1 Use interface builder.

2 Layout your interface super-easily using groups.

3 Be creative with your image based animations.

4 Display useful and minimal information to users.

If you’re thinking that there’s no point in even making an app after looking at the lists above because you can’t do anything you do in your iOS app, then you’re looking at this all wrong. This is a whole new ball game, the point isn’t to create an iOS app for your Watch, rather to create a Watch app for your Watch – and those are two entirely different things. If you still don’t believe me, keep reading, but more importantly take a nosedive into the WatchKit SDK and start trying to actually build something fantastic.

On that note let’s take a run through of the major components of WatchKit (and the watch in general) to see what it’s capable (or not) of.

Tables:

If you’re not already using table views extensively within your iOS apps, then, let’s face it: you’re doing it all wrong. Tables have taken a turn for the better in WatchKit, although losing a bit of power in the process.

The one main can’t here is having dynamic interfaces determined at runtime: the layout of your cells is determined in your storyboards and there’s no way of modifying layouts – other than hiding elements – at runtime. Sadly, this also means there’s no easy way to do mixing and matching of cell types within a table. Don’t get this confused with not being able to provide dynamic content though, that is a definite yes.

One of the things missing in tables in our opinion outweighs this though, and that is (our beloved) delegate callbacks! You can also have dynamically sized cells, which is a major step-up from iOS resulting from the powerful groups addition to WatchKit.

Interface builder:

In WatchKit you simply cannot work without interface builder like you can for iOS (And to a certain extent OSX), this may result in a learning curve for developers who like to work programmatically – us included – but trust us when we say: it’s a minimal one, and it’s more than worth it!

The main reason we say it’s more than worth it is that interface builder for Watch brings with it Groups, which are, fantastic in every way! Forget auto-layout (Well unfortunately we’re still stuck with it on iOS), this is a much more elegant and easier solution for getting all your views in order.

Staying alive (ahh ahh ahh ahh):

Simply forget about trying to force the watch to stay awake longer than it wants to be.

We’ve had a seriously long and hard search for any mention of a way to keep the screen active, and it ain’t there. Trust us, and forget your awesome idea which involves draining the users battery in a matter of minutes, which is probably for the best anyway.

On a side note, you can also forget about manually forcing opening your application on the users phone, there’s no access to UIApplication – don’t forget we’re still in extension land here – so the best you can do is ask for the phone to perform a function in the background using the WKInterfaceController method.

+ (BOOL)openParentApplication:(NSDictionary *)userInfo reply:(void (^)(NSDictionary *replyInfo, NSError *error))reply

Which launches your app in the background and asks it to perform functions within this method:

 

  – (void)application:(UIApplication *)application handleWatchKitExtensionRequest:(NSDictionary *)userInfo reply:(void(^)(NSDictionary *replyInfo))reply

 

on your app delegate.

And always remember, this is a godsend.

Animation:

Forget all the niceties of Core Animation, view-based animation (or whatever animation you love the most), from now on you’re going to be rendering all your animations out beforehand. Although don’t let that put you off, there are some lovely effects you can create with simple image-based animations.

Device functions:

Currently, there is no way to use any of the features that are the main selling points of the watch, you have no direct access to the heart-rate monitor, there’s no way to send haptic feedback, and there’s no way to play sound directly on the watch. It may be that at some point in the life of the watch and WatchKit that apple allow us more access to this kind of feature, but bear in mind: we didn’t get an iOS SDK until the iPhone 3G came to the market.

After working with WatchKit for a good few weeks we’ve come across a lot that we can and can’t do with it, but have come to the pleasant conclusion that it is plenty powerful enough for what you **should** be doing with it!

Published on January 20, 2015, last updated on April 9, 2019

Give us the seal of approval!

Like what you read? Let us know.

0

Tags