Does WatchKit Extension code run on watch in watchOS 2?

I am wondering if there's any available documentation outlining the different approaches to building for OS 1 vs. OS 2, or if it's just the same and the WatchKit Extension code just runs on the watch...

Answered by Technology Evangelist in 5847022

It's very similar, but that the WatchKit Extension now resides and runs on Apple Watch. See the updated documentation for differences. You'll find that almost all your Storyboards and UI code will be fine, but that your data code will probably need to be updated to use WatchConnectivity.

Accepted Answer

It's very similar, but that the WatchKit Extension now resides and runs on Apple Watch. See the updated documentation for differences. You'll find that almost all your Storyboards and UI code will be fine, but that your data code will probably need to be updated to use WatchConnectivity.

Thanks, Behrens,


Where will we find WatchConnectivity documentation?

Will the simulator in Xcode 7 beta allow us to experiment with this configuration? Or are we required to install iOS 9 and register our watch to test this?


Mike

Does the WatchKit Extension have to run on the Watch? My app does a lot of heavy duty calculations -- I think the performance on the Watch would be terrible compared to running on the iPhone. It doesn't seem like 2.0 will have a 1.0 compatibility mode where 1.0 apps can run unmodified on 2.0 like they do now. Is that the case? Will every existing app have to be rewritten eventually to run on 2.0?

Well, first you need to decide what you should put in different places. ie: watchos2 requires a different way of thinking. What are you calculating? If the "inputs" for the calculations come directly from Apple Watch, then it is much better that the extension runs on Apple Watch itself. If the "inputs" do NOT come directly from Apple Watch, you may think about doing calculations in parent app in background (or even on a server) and using WatchConnectivity to send them to Apple Watch from the parent iOS app.


For instance, we (at Mouseaddict) track where the user goes inside of Disneyland when they are visiting. This type of data can be displayed on Apple Watch in a glance or watch app. (it does not now, but it could). This would be perfect for running on the parent app because the datam we are "crunching" does not come directly from Apple Watch itself - it is lat/lon and the phone provides that because Apple Watch doesn't have a GPS. Hence this should be crunched in the bkg on the parent iOS app and sent back to Apple Watch for display to the user using WatchConnectivity. This method is also faster because the CPU on the phone is currently much more powerful than that of Apple Watch.


However, when the user submits a wait time from Apple Watch to let us know the wait time of (for instance) the Matterhorn, this could bypass the phone and be submitted directly from Apple Watch to our servers to crunch that data...then later be fetched from our servers in the form of an average wait time. In *this* scenario, it is perfect for us because we just bypassed any communication back to the parent iOS app.



I hate rearchiteching so early in the Apple Watch "game" but it gives so many more options I am willing to do it.

The inputs don't come from the Watch so the calculations could be done anywhere, but I was hoping to avoid having to fire up the main iPhone app to do them (overkill). It worked out great in 1.0 doing the calculations in the WatchKit Extension because it could use the full power of the iPhone's processing capability and display the results on the Watch.

I'm still trying to catch up here. jgobble, how does your current app work in the 2.0 simulator? As in, you've got lat/long being run "on the watch" (ie background in the phone) and displayed on the watch. What happens when watch 2.0 asks for a lat/long position? does it just fail now because the watch has no GPS, or is it smart enough to get it from the phone? In other words, will current code asking for lat/long still work, or does it have to be redone with watchConnectivity to work now?


As you say, a lot of stuff to have to redo so soon after the 1.0 release!


thanks for the help here.

Does WatchKit Extension code run on watch in watchOS 2?
 
 
Q