In the age of watchOS 1, the watchKit extension was on the paired iOS device, making sharing data between it and the main iOS app easy. For the simplest of data, like preferences, we could just use NSUserDefaults with App Groups functionality. We still should use that when sharing data between other extensions that still remain on the phone, like today view extensions, but not for watchOS apps anymore.
Luckily, Apple gave us a new API to use, that is significantly more robust than piggy-backing on App Groups, Watch Connectivity. Watch Connectivity gives a lot more information about the status of the connection between your Apple Watch and its paired iPhone. It also allows interactive messaging between the iOS App and the watchOS app, as well as background transfers that come in 3 flavors. Those flavors are:
- Application Context
- User Info Transfer
- File Transfer
Today we will be talking about the first one, Application Context.