feat: add support for scheduled Live Activities via startDate
#26
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
feat: add support for scheduled Live Activities via
startDateAdds support for Apple's
Activity.request(startDate:)API, allowing Live Activities to be scheduled to appear at a future date instead of immediately. Requires iOS 17.2+. Fully backward-compatible.Handles the iOS 26.0 deprecation — uses the new
start:parameter on iOS 26+ and falls back tostartDate:on earlier versions.How it works
Three reserved attribute keys (prefixed with
_to avoid collisions):_startDateDouble_alertTitleString_alertBodyStringWhen
_startDateis present,Activity.request(startDate:)is called with anAlertConfiguration. When absent, existing behavior is preserved.Usage
Use case
Schedule Live Activity state transitions on-device — no server push, no background tasks. Example: start a countdown now, schedule a "LIVE" activity to appear automatically at the target time.
Use case: I was struggling to change a counter to show a simple text after the countdown reaches zero, using two live activities scheduled instead of just one, did the job just right! This way we can transition between states easily.
Working example:
https://github.com/user-attachments/assets/dc4f84ef-32d5-4e85-bfea-3f3d69732dbe