I am trying to learn how to develop watchapps for the Apple Watch, and one thing seems a bit difficult to me: how's data supposed to be shared between the watchapp and the complication controller?
Most examples I see online follow the following order:
1 - download data on the ExtensionDelegate, and use it on the InterfaceController;
2 - get the ComplicationController to get the data from the ExtensionDelegate
3 - Add a background task on the ExtensionDelegate so that it downloads updated data that will be used by both the InterfaceController and ComplicationController, updating both.
So my data is in a collection at the ExtensionDelegate. I wonder:
1 - Who should initially get my ExtensionController to download the data when initiating the app? My ComplicationController or my InterfaceController? I ask this because on xcode there is a simulator for each of these, so sometimes I dunno which is called first when starting the app. Should the complication only start its life-cycle after an app is opened by the user, thus forcing a first data loading, or does it start after installing the app? Or should add a flag on the ExtensionDelegate to flag if there's no data downloaded, there's data being downloaded, there's data available (ie., collection is not null), so that either the ComplicationController or the InterfaceController can trigger a first data download?
2 - While my background download task works, I feel that over a few hours, my app has to be reloaded when opening, as if it wasn't opened before, thus triggering a new download of data. The data on it differs then from the data already downloaded and shown by the ComplicationController. What is a good strategy to tackle this? Any pointers on what I should be checking?