Skip to content
Development
Skill

/live-activity-generator

Generate ActivityKit Live Activity infrastructure with Dynamic Island layouts, Lock Screen presentation, and push-to-update support. Use when adding Live Activities to an iOS app.

From plugin
rshankras-apple-skills
848181 skills

Claude Code

$ npx -y skills add rshankras/claude-code-apple-skills --skill live-activity-generator --agent claude-code

SKILL.md

live-activity-generator.SKILL.md
name: live-activity-generator
description: Generate ActivityKit Live Activity infrastructure with Dynamic Island layouts, Lock Screen presentation, and push-to-update support. Use when adding Live Activities to an iOS app.
allowed-tools: [Read, Write, Edit, Glob, Grep, Bash, AskUserQuestion]
last_verified: 2026-07-16
review_by: 2027-06-22
os_version: iOS 27 / macOS 27

Live Activity Generator

Generate a complete ActivityKit Live Activity implementation with Dynamic Island layouts, Lock Screen presentation, activity lifecycle management, and push-to-update support.

When This Skill Activates

Use this skill when the user:

  • Asks to "add Live Activities" or "add a Live Activity"
  • Mentions "Dynamic Island" layouts
  • Wants real-time status updates on the Lock Screen
  • Asks about "ActivityKit" or "ActivityAttributes"
  • Mentions "push-to-update" for live activities
  • Wants to show ongoing progress (delivery tracking, sports scores, timers, workouts)

Pre-Generation Checks

1. Project Context Detection

  • [ ] Check for existing ActivityKit implementations
  • [ ] Check for an existing widget extension target
  • [ ] Verify deployment target is iOS 16.1+
  • [ ] Identify source file locations

2. Conflict Detection

Search for existing Live Activity code:

Glob: **/*Activity*.swift, **/*LiveActivity*.swift
Grep: "ActivityKit" or "ActivityAttributes" or "ActivityConfiguration"

If an existing widget extension is found:

  • Ask if the Live Activity should be added to the existing widget bundle
  • Check for existing `WidgetBundle` to extend

If Live Activity code already exists:

  • Ask user whether to replace or extend

3. Required Capabilities

**Live Activities require:**

  • iOS 16.1+ deployment target
  • `NSSupportsLiveActivities` set to `YES` in Info.plist
  • A widget extension target (can share with existing WidgetKit widgets)
  • For push updates: `NSSupportsLiveActivitiesFrequentUpdates` (optional, iOS 16.2+)

Configuration Questions

Ask user via AskUserQuestion:

1. **What is the Live Activity for?** (freeform)

  • Examples: delivery tracking, sports score, workout timer, ride-sharing, food order
  • This determines the attribute fields and content state

2. **What data should appear on the Lock Screen?** (freeform)

  • Static data (set at start, does not change): e.g., restaurant name, order number
  • Dynamic data (updated over time): e.g., ETA, driver location, score

3. **Dynamic Island layout needs?**

  • Compact (leading + trailing) only
  • Expanded (leading, trailing, center, bottom) only
  • Both compact and expanded (recommended)

4. **Push-to-update support?**

  • Yes -- server can update the activity remotely via APNs
  • No -- updates only from the app process

5. **Alert configuration when ending?**

  • Yes -- show a final alert on the Lock Screen when the activity ends
  • No -- dismiss silently

Generation Process

Step 1: Determine File Locations

Check project structure:

  • If a widget extension target exists, add files there
  • Otherwise, instruct user to create a Widget Extension target first

For the activity manager (lives in the main app target):

  • If `Sources/` exists --> `Sources/LiveActivity/`
  • If `App/` exists --> `App/LiveActivity/`
  • Otherwise --> `LiveActivity/`

For the widget extension views:

  • Place inside the existing widget extension directory (e.g., `MyAppWidgets/`)

Step 2: Create Core Files

Generate these files based on configuration answers:

1. **`{Name}ActivityAttributes.swift`** -- Shared between app and widget extension

  • `ActivityAttributes` struct with static properties
  • Nested `ContentState` with dynamic properties

2. **`{Name}LiveActivityView.swift`** -- Widget extension file

  • `ActivityConfiguration` with Lock Screen, Dynamic Island layouts

3. **`{Name}ActivityManager.swift`** -- Main app target file

  • Protocol-based manager for start, update, end, and push token handling

Step 3: Generate Code from Templates

Use the templates in **templates.md** and customize based on user answers:

  • Replace placeholder attribute names with real fields
  • Configure Dynamic Island regions based on layout choice
  • Include or exclude push-to-update code
  • Include or exclude alert configuration

Info.plist Required

Main App Target

<key>NSSupportsLiveActivities</key>
<true/>

<!-- Optional: for frequent push updates (iOS 16.2+) -->
<key>NSSupportsLiveActivitiesFrequentUpdates</key>
<true/>

Output Format

After generation, provide:

Files Created

Sources/LiveActivity/
├── {Name}ActivityAttributes.swift     # Shared: attributes + content state
└── {Name}ActivityManager.swift        # Main app: lifecycle management

MyAppWidgets/
├── {Name}LiveActivityView.swift       # Widget ext: all Live Activity UI
└── (update WidgetBundle if needed)

Integration Steps

**1. Add the widget extension target (if not present):**

  • File > New > Target > Widget Extension
  • Ensure "Include Live Activity" is checked

**2. Share the attributes file between targets:** The `{Name}ActivityAttributes.swift` file must be included in both the main app target and the widget extension target. Select the file in Xcode, open the File Inspector, and check both targets under "Target Membership".

**3. Add Info.plist entries in the main app target:**

<key>NSSupportsLiveActivities</key>
<true/>

**4. Register the Live Activity configuration in the widget bundle:**

@main
struct MyAppWidgets: WidgetBundle {
    var body: some Widget {
        // Existing widgets...
        MyAppLiveActivity()
    }
}

**5. Start a Live Activity from your app:**

let attributes = DeliveryActivityAttributes(
    orderNumber: "1234",
    restaurantName: "Pizza Place"
)

let initialState = DeliveryActivityAttributes.ContentState(
    status: .preparing,
    estimatedDelivery: Date().addingTimeInterval(30 * 60),
    driverName: nil
)

let manager = LiveActivityManager()
try await manager.star
Read more
@rshankras
Ships withrshankras-apple-skills

A collection of Claude Code skills for iOS, macOS, watchOS, visionOS, and Apple platform development. These skills help you plan and build apps, maintain code quality, ensure HIG compliance, and guide you from idea to App Store.

Stars on GitHub

Momentum

stars in total
848
Star history of rshankras/claude-code-apple-skills on GitHub, a chart by star-history.com

Other skills on rshankras-apple-skills.

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills10d309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc12d293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react1d252k
@facebook@facebookInstall Skill

Questions about live-activity-generator.

Which coding agents can use live-activity-generator?
live-activity-generator installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.