What is a Watch app?

Hi,


I'm having a tough time understanding exactly what a Watch app is, as someone familiar with iOS development but not WatchOS.


I watched an early tutorial from WWDC which explained clearly that a Watch extension is part of an iOS app on an iPhone that can send information to a UI that is displayed on your watch. All the code runs on your phone, only the UI elements are on your watch, and the OS takes care of moving the data when you assign it to UI elements. This makes sense.


However, I think it's either obsolete or incomplete now because later stuff I'm reading talks about a whole communications framework for moving data from your main app to your watch app.


Help me understand this -- does a Watch extension contain actual code I write that runs on the actual CPU of the watch? Or does all the code run on the phone? Is a "Watch App" now an independent app or does the term "Watch App" refer to an iOS app that contains an extension?


How are Watch apps expected to behave if the user's iPhone is not nearby? Are they able to run at all? Does having cellular on your watch change this?


Does Apple Watch use Bluetooth to communicate with your phone or something else? I assume it has to be Bluetooth because you can't count on both devices being connected to the same Wifi network all the time. (I'm not even sure if the watch even has a Wifi radio).


What's the best way to read about the current capabilities of this system as a new user? I've searched and searched but find that there are mostly two types of information out there, one being really good introductions that are years out of date, and the other being really good explanations of what's new in some version of Watch OS that is confusing and incomplete from the standpoint of someone who isn't already thoroughly familiar with the previous version.


Thanks,

Frank

Replies

>having a tough time understanding exactly what a Watch app is


Quick summary of the types are:

  1. Watch App
  2. Watch App with Glance
  3. Watch App with Actionable Notifications
  4. Watch App with Glance and Actionable Notifications
  5. "Fully Native Apps"


For more info, see WatchKit Frequently Asked Questions

There are three functions here. Stuff done on the iPhone (the iPhone App), stuff done on the Watch display (the Watch App - includes the storyboard) and stuff done to determine what to display on the Watch display (the Watch Kit Extension - includes your code that determines what to display on the watch and also communicates with the iPhone App). It used to be that the Watch Kit Extension resided on the iPhone. That meant that communication between the Watch Kit Extension and the iPhone App was pretty easy (i.e. just use NSUserDefaults) but that you had to be careful with how you manipulated the display since that involved communications between the Watch Kit Extension on the iPhone and the Watch App on a remote Watch connected through Bluetooth. But in WatchOS2 they moved the Watch Kit Extension into the watch. That meant that communicating between the Watch Kit Extension (the code that determines what to display on the watch) and the watch was trivial but communicating between the Watch Kit Extension code and the iPhone App code was more complicated (no more shared file space). Additionally, they gave the Watch Kit Extension, residing on the watch, a lot more capabilities. Lots of this is explained here:


https://developer.apple.com/library/archive/documentation/General/Conceptual/WatchKitProgrammingGuide/DesigningaWatchKitApp.html

Thanks, that's very helpful.


I keep seeing the word "storyboard" used in conjunction with Watch apps. Is it really necessary to have a storyboard? I typically develop with XIB files.


Frank

"A Watch app consists of two bundles: the Watch app bundle and the WatchKit extension bundle."


Why is this? It seems unnecessary and inefficient. Why aren't the Watch app and the extension just one bundle?

I agree 100%. XIBs are cleaner than Storyboards. However for the watch you will be using the 'storyboard' called Interface.storyboard supplied by the system. I use it like an XIB and ignore all the fancy storyboard features. The system will allocate whatever code it wants to the 'WatchKit App'. You don't need to do anything.

The developer gets to ignore the WatchKit App. The system handles that. I suspect the two bundles contain features that get allocated to different parts of the watch. As indicated above, the two bundles used to reside on two different devices (watch/iPhone).

Help me understand this -- does a Watch extension contain actual code I write that runs on the actual CPU of the watch? Or does all the code run on the phone? Is a "Watch App" now an independent app or does the term "Watch App" refer to an iOS app that contains an extension?


How are Watch apps expected to behave if the user's iPhone is not nearby? Are they able to run at all? Does having cellular on your watch change this?


Yes, there is code executing on the watch, independant of the iPhone (that was not the case if I remeber well on early WatchOS1 or 2).


As far as I understand, the iPhone app is at least needed as a "carrier" to download app on the Watch (hope that could change some day ?)


When iPhone is not nearby, Watch app is expected to work normally, except for the tasks that require data transfer from the phone.


In on case of a Watch App, I use this communication to download data that can only be created on iPhone ; and to read user preferences, if ever they changed.



I keep seeing the word "storyboard" used in conjunction with Watch apps. Is it really necessary to have a storyboard? I typically develop with XIB files.


I personnaly use storyboard (no segue though) for Watch UI. I find it pretty convenient to see all the Watch screens on the same display.



What's the best way to read about the current capabilities of this system as a new user?

In my case, I learned by studying an example (the AirAber tutorial) and that was enough to strat.


I learned in particular the role of shared data in the Watch part (not the Watch Extension) and the need to belong to both targets iPhone and extension.