Live Activity && WidgetKit == Fun?
Part 1: A recipe for an (offline) Live Activity
November 26, 2024
GuideSuccessBy “offline” I mean its content is static and won’t receive updates.
Building a Live Activity on iOS comes with a long list of “can’t do’s.” These constraints are worth understanding because they shape how we approach our designs. For example, Live Activities cannot:
• Make network requests (e.g., fetching an image or calling an API).
• Execute callback functions for timers or progress completion.
• Run custom animations outside of built-in views like ProgressView or Text.init(timerInterval...).
Moreover, “offline” Live Activities are limited in their ability to change dynamically — updates must be triggered by remote notifications.
So why bother?
Despite these limitations, an offline Live Activity still has potential to deliver real-time, useful information directly to the user’s Lock Screen. With a little creativity, we can work within these constraints to create something valuable.
Our Goal: An Offline Live Activity
This series will guide you through designing and implementing a Live Activity that doesn’t rely on remote notifications. Specifically, we’ll build a sauna reservation activity that includes:
• A progress bar to track the session duration.
• A countdown timer to show remaining time.
• A remote image with an overlay.
• A CTA to dive into a specific area of the main app.
In the process, we’ll tackle challenges like handling shared data, supporting light/dark mode, and troubleshooting some common issues during widget and extension development.
What You’ll Learn
Throughout this series, we’ll explore:
1. How to design and set up a Live Activity.
2. How to integrate dynamic elements like images and timers.
3. How to enhance user experience (Smart Stack on watchOS, and translucent background on the Lock Screen).
4. How to clean up expired activities to keep data relevant.
Up next
If you’ve ever felt limited by Live Activity constraints, this series will help you rethink those boundaries and see what’s possible. Let’s dive in!
All the source code for this series is on Github!