Apple & iOS
AuraScore 83/100

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.

Template

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

  1. Define the ActivityAttributes data model and the dynamic content state struct for {{feature_name}}.
  2. Specify layout presentations across compact leading, compact trailing, minimal, and expanded Dynamic Island regions.
  3. Establish the remote notification payload contract mapping JSON keys to the {{background_payload_schema}}.
  4. Design the ActivityKit push token registration, invalidation, and rotation flow per {{push_token_lifecycle}}.
  5. Configure BGAppRefreshTask and BGProcessingTask handling to maintain sync within {{update_frequency_sla}}.
  6. Specify stale state transitions, dismiss timers, and fallbacks when device conditions exceed {{battery_budget_limit}}.
  7. 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:

  1. State Model and Attributes Definition (Swift structs for static and dynamic state)
  2. UI Region Layout Matrix (Dynamic Island compact, minimal, expanded, and Lock Screen)
  3. Push and Background Execution Lifecycle (APNs payload structure and token rotation flow)
  4. 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.
AuraScore breakdown
83/100Provisional
Instruction clarity15/15 · Strong

Explicit role, a named task, and discrete steps the model can follow.

Context architecture12/12 · Strong

Background, inputs and variables the model needs before it starts.

Constraint engineering12/12 · Strong

Hard boundaries — what the model must and must not do.

Output specification6/14 · Thin

A named, field-level shape for the response.

Reasoning structure10/10 · Strong

Ordered work items that force analysis before an answer.

Model compatibility10/10 · Strong

Length and structure that travel across frontier models.

Token efficiency5/10 · Thin

Signal density — instruction weight without padding.

Reusability7/7 · Strong

Documented variables so the scaffold adapts to new inputs.

Robustness5/5 · Strong

Quality bar, assumptions and behaviour when inputs are thin.

Observed performance1/5 · Thin

How much real usage the template has behind it.

developers
developers-apple
software-engineering-debugging
widgetkit
activitykit
ios