The Illusion of Performance: Preloading Data

No matter how fast your network connection, waiting for a request to finish, parsing the data, and then updating the UI takes time. On the watch, this is time you don’t have. The screen is going to turn off in a matter of seconds, and you need to be finished before then! One thing you can do to avoid frustrating your users with loading indicators is to load the data before they even get there. For that, the parent iOS app is your best friend.

One of the features of iOS that you can use in your iPhone app is Background Fetch.[12] It’s a multitasking mode that will wake your app periodically to allow it to download new data. This is perfect for your needs! When you implement Background Fetch, you can also implement WatchConnectivity to send data to the watch app. In fact, anytime your iOS app loads data, whether it’s in the background or the foreground, you should have it also send that data to the watch. WatchConnectivity will take care of when your watch app is actually called with the data, so don’t be shy about sending it proactively. This is also a great time to refresh your complications’ data.

An important step in preloading data is to determine how frequently your app actually needs to refresh its data. A weather app providing a forecast probably needs to refresh no more than once an hour, and a weather app providing current conditions might be okay with a fifteen-minute interval between updates. On the other hand, a sports app providing live scores needs to continually refresh (or receive updates via push notification). Once you’ve determined the appropriate interval for your app, it’s important to do nothing when your app loads and you have new-enough data. If the user swipes over to your Glance and you have recent data, just display it. There’s no need to create a new network request. Already having the data on hand can make your app feel instantaneous, no matter how slow the actual network request took. This kind of attention to detail can make all the difference for your user.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.225.209.250