WidgetKit Dynamic Island and Background Lifecycle Spec
Define a system integration specification for iOS Live Activities, Dynamic Island layouts, and background task schedulers.
Use this template when designing real-time Live Activities and ActivityKit push pipelines for iOS apps. It establishes strict constraints for payload budgets, battery governance, and widget state machines.
Role: Principal iOS Platform Engineer specializing in WidgetKit, ActivityKit, and iOS power governance.
Context
- Experience Name: {{feature_name}}
- Supported Device Matrix: {{target_device_family}}
- Update Frequency SLA: {{update_frequency_sla}}
- Background Payload Schema: {{background_payload_schema}}
- Power Budget Constraints: {{battery_budget_limit}}
- Token Lifecycle Strategy: {{push_token_lifecycle}}
Task
Draft an end-to-end technical specification for building {{feature_name}} on {{target_device_family}}, configuring ActivityKit dynamic island presentations, remote push-to-start updates, and BGTaskScheduler tasks within {{battery_budget_limit}}.
Method
- Define the ActivityAttributes data model and the dynamic content state struct for {{feature_name}}.
- Specify layout presentations across compact leading, compact trailing, minimal, and expanded Dynamic Island regions.
- Establish the remote notification payload contract mapping JSON keys to the {{background_payload_schema}}.
- Design the ActivityKit push token registration, invalidation, and rotation flow per {{push_token_lifecycle}}.
- Configure BGAppRefreshTask and BGProcessingTask handling to maintain sync within {{update_frequency_sla}}.
- Specify stale state transitions, dismiss timers, and fallbacks when device conditions exceed {{battery_budget_limit}}.
- Detail memory footprint mitigation ensuring the widget extension remains within system memory caps.
Constraints
- MUST enforce strict 4KB payload payload limits on ActivityKit APNs pushes.
- MUST NOT exceed background CPU limits defined by {{battery_budget_limit}}.
- Widget view rendering code must be fully isolated from main app runtime dependencies.
- All state rendering must account for lock screen ambient mode and Always-On displays.
Output format
Structure the deliverable into four sequential sections:
- State Model and Attributes Definition (Swift structs for static and dynamic state)
- UI Region Layout Matrix (Dynamic Island compact, minimal, expanded, and Lock Screen)
- Push and Background Execution Lifecycle (APNs payload structure and token rotation flow)
- Power and Resource Guardrails (Stale-state timeouts, throttling, and memory caps) Maintain a total length between 450 and 750 words.
Self-review
- Ensure {{feature_name}}, {{target_device_family}}, and {{update_frequency_sla}} are explicitly integrated.
- Confirm the APNs push payload structure matches {{background_payload_schema}}.
- Verify all constraints regarding battery usage and payload size limits are present.
Explicit role, a named task, and discrete steps the model can follow.
Background, inputs and variables the model needs before it starts.
Hard boundaries — what the model must and must not do.
A named, field-level shape for the response.
Ordered work items that force analysis before an answer.
Length and structure that travel across frontier models.
Signal density — instruction weight without padding.
Documented variables so the scaffold adapts to new inputs.
Quality bar, assumptions and behaviour when inputs are thin.
How much real usage the template has behind it.