
alarmkit
Implement AlarmKit alarms and countdown timers for iOS and iPadOS with Lock Screen, Dynamic Island, StandBy, and paired Apple Watch system UI. Covers AlarmManager scheduling, AlarmAttributes and AlarmPresentation, system Stop and AlarmButton secondary actions, authorization, state observation, countdown widget-extension handoff, and Live Activity integration. Use when building wake-up alarms, countdown timers, or alarm-style alerts that need Apple's system alarm experience.
- Installs
- 3.6K
- Last 24h
- +15
- Trending rank
- #6924
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/dpearson2699/swift-ios-skills --skill alarmkit- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads alarmkit automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
AlarmKit
Schedule prominent alarms and countdown timers that surface on the Lock Screen, Dynamic Island, StandBy, and a paired Apple Watch when the alarm fires. AlarmKit requires iOS 26+ / iPadOS 26+. Alarms can break through Focus and Silent mode.
AlarmKit uses ActivityKit data models for its Live Activity, but the firing alert
is system-managed alarm UI, not a general custom notification UI surface. Custom
UI belongs only to countdown and paused Live Activity states rendered by a Widget
Extension with the same AlarmAttributes<Metadata> and
AlarmPresentationState used when scheduling.
See references/alarmkit-patterns.md for complete code patterns including authorization, scheduling, countdown timers, snooze handling, and widget setup.
import AlarmKit
Contents
- Workflow
- Authorization
- Alarm vs Timer Decision
- Scheduling Alarms
- Countdown Timers
- Alarm States
- AlarmAttributes and AlarmPresentation
- AlarmButton
- Live Activity Integration
- Common Mistakes
- Review Checklist
- References
Workflow
1. Create a new alarm or timer
- Add
NSAlarmKitUsageDescriptionto Info.plist with a user-facing string. - Request authorization with
AlarmManager.shared.requestAuthorization()when the app can explain the value, or handle the first-schedule system prompt. - If authorization is
.deniedor not.authorized, show recovery UI instead of scheduling. - Configure
AlarmPresentation(alert, countdown, paused states). - Create
AlarmAttributeswith the presentation, optional metadata, and tint color. - Build an
AlarmManager.AlarmConfiguration(.alarm or .timer). - Schedule with
AlarmManager.shared.schedule(id:configuration:). - Observe
alarmManager.alarmUpdatesand confirm the scheduled ID reaches the expected state. - If using countdown, add a Widget Extension target with an
ActivityConfigurationfor the sameAlarmAttributes<Metadata>type.
2. Review existing alarm code
Run through the Review Checklist at the end of this document.
Authorization
AlarmKit requires user authorization. Request early when the app can explain the value, or let AlarmKit prompt automatically on first schedule. If authorization is not granted after the explicit or automatic prompt, alarms are not scheduled and will not alert.
let manager = AlarmManager.shared
// Request authorization explicitly
let state = try await manager.requestAuthorization()
guard state == .authorized else { return }
// Check current state synchronously
let current = manager.authorizationState // .authorized, .denied, .notDetermined
// Observe authorization changes
for await state in manager.authorizationUpdates {
switch state {
case .authorized: print("Alarms enabled")
case .denied: print("Alarms disabled")
case .notDetermined: break
@unknown default: break
}
}
Alarm vs Timer Decision
| Feature | Alarm (.alarm) | Timer (.timer) |
|---|---|---|
| Fires at | Specific time (schedule) | After duration elapses |
| Countdown UI | Optional | Always shown |
| Recurring | Yes (weekly days) | No |
| Use case | Wake-up, scheduled reminders | Cooking, workout intervals |
Use .alarm(schedule:...) when firing at a clock time. Use .timer(duration:...)
when firing after a duration from now.
Scheduling Alarms
Alarm.Schedule
Use .fixed(date) for a one-time absolute date or .relative for a local clock
time with .never or .weekly repetition. Load
Recurring Alarm Patterns
for daily, weekday, weekend, and fixed-date variants.
Schedule and Configure
let id = UUID()
let alert = AlarmPresentation.Alert(
title: "Wake Up",
secondaryButton: AlarmButton(
text: "Snooze", textColor: .white, systemImageName: "bell.slash"
),
secondaryButtonBehavior: .countdown
)
let presentation = AlarmPresentation(alert: alert)
struct EmptyAlarmMetadata: AlarmMetadata {}
let attributes = AlarmAttributes<EmptyAlarmMetadata>(
presentation: presentation,
metadata: nil,
tintColor: .indigo
)
let snooze = Alarm.CountdownDuration(preAlert: nil, postAlert: 300)
let configuration = AlarmManager.AlarmConfiguration(
countdownDuration: snooze,
schedule: .relative(.init(
time: .init(hour: 7, minute: 0),
repeats: .never
)),
attributes: attributes,
sound: .default
)
let alarm = try await AlarmManager.shared.schedule(
id: id,
configuration: configuration
)
For an authorization-gated function and metadata-bearing variant, load Complete Alarm Scheduling Flow.
stopIntent and secondaryIntent default to nil. Omit stopIntent for
AlarmKit's standard system Stop behavior; provide it only when Stop must run app
cleanup, custom stop behavior, or other side effects. Omit secondaryIntent for
ordinary Snooze/Repeat with secondaryButtonBehavior: .countdown and
Alarm.CountdownDuration.postAlert; provide it only for .custom secondary
behavior or app cleanup/custom behavior.
Alarm State Transitions
cancel(id:)
|
scheduled --> countdown --> alerting
| | |
| pause(id:) stop(id:) / countdown(id:)
| |
| paused ----> countdown (via resume(id:))
|
cancel(id:) removes from system entirely
cancel(id:)-- remove the alarm completely, including repeating alarmspause(id:)-- pause a counting-down alarm; throws from other statesresume(id:)-- resume a paused alarm; throws from other statesstop(id:)-- stop the alarm; one-shot alarms are removed, repeating alarms reschedulecountdown(id:)-- restart countdown from alerting state (snooze); throws from other states
Countdown Timers
Timers fire after a duration and always show a countdown UI. Use
Alarm.CountdownDuration to control pre-alert and post-alert durations.
CountdownDuration
Alarm.CountdownDuration controls the visible countdown phases:
preAlert-- seconds to count down before the alarm fires (the main countdown)postAlert-- seconds for a repeat/snooze countdown after the alarm fires
Load Complete Countdown Timer Flow for the timer factory, pause/resume presentation, metadata, and scheduling gate.
Alarm States
Each Alarm has a state property reflecting its current lifecycle position.
| State | Meaning |
|---|---|
.scheduled | Scheduled and ready to alert at the appropriate time |
.countdown | Actively counting down (timer or pre-alert phase) |
.paused | Countdown paused by user or app |
.alerting | Alarm is firing -- sound playing, UI prominent |
Observing State Changes
AlarmManager.shared.alarms is a throwing getter for the current daemon
snapshot. Use try, and either propagate the error or wrap launch refresh in
do/catch before relying on the snapshot.
Observe alarmUpdates rather than maintaining an independent lifecycle. Load
State Observation with Async Sequences
for the complete store and refresh loop.
An alarm that disappears from alarmUpdates is no longer scheduled with
AlarmKit. Compare against app-persisted IDs when you need to distinguish fired,
cancelled, and rescheduled alarms.
AlarmAttributes and AlarmPresentation
AlarmAttributes conforms to ActivityAttributes and defines the static
data for the alarm's Live Activity. It is generic over a Metadata type
conforming to AlarmMetadata, which inherits Decodable, Encodable,
Hashable, and Sendable. The metadata value itself is optional and defaults
to nil.
AlarmPresentation supplies the required alerting content and optional
countdown/paused content. The system renders alerting UI; a widget extension can
customize countdown and paused Live Activity views with the same attributes and
presentation state. Keep metadata lightweight, use nil when it is unnecessary,
and share its type with the widget extension.
AlarmPresentationState
AlarmPresentationState is the system-managed ContentState of the alarm
Live Activity. It contains the alarm ID and a Mode enum:
.alert(Alert)-- alarm is firing, includes the scheduled time.countdown(Countdown)-- actively counting down, includes fire date and durations.paused(Paused)-- countdown paused, includes elapsed and total durations
The widget extension reads AlarmPresentationState.mode to decide which UI to
render in the Dynamic Island and Lock Screen for non-alerting states.
AlarmButton
AlarmButton defines the text, color, and symbol for an alarm action. The
representative scheduling example above shows a standard Snooze button.
Secondary Button Behavior
The secondary button on the alert UI has two behaviors:
| Behavior | Effect |
|---|---|
.countdown | Restarts a countdown using postAlert duration (snooze) |
.custom | Triggers the secondaryIntent (e.g., open app) |
Live Activity Integration
AlarmKit alarms appear as Live Activities on the Lock Screen, Dynamic Island,
StandBy, and on a paired Apple Watch when the alarm fires. The system manages
the alerting UI. For countdown and paused states, add a Widget Extension target
whose ActivityConfiguration uses the same AlarmAttributes<Metadata> type
used when scheduling the alarm.
A widget extension is expected if your alarm uses countdown presentation. Keep that lightweight metadata type available to both the app and widget extension. Without the extension, alarms may be dismissed unexpectedly or fail to alert, though the system can still show a fallback countdown UI in limited cases such as after a device restart before first unlock.
| Work | Owner |
|---|---|
| Authorization, scheduling/state, presentation, sound, system alarm actions | AlarmKit |
| Home Screen/Smart Stack widgets, families, timelines, reloads | widgetkit |
| Non-alarm Live Activity lifecycle, tokens, remote content state | activitykit |
| APNs, notification categories/actions, custom notification UI | push-notifications |
AlarmKit's alert is system-rendered on Lock Screen, Dynamic Island, StandBy, and paired Apple Watch; only countdown/paused states use the widget extension.
For setup, name Apple-documented NSAlarmKitUsageDescription and AlarmManager
authorization. Do not require unsupported AlarmKit setup keys or
com.apple.developer.alarmkit unless a current Apple source documents them.
Load Live Activity Widget Extension for Alarms
for the complete shared-attributes widget implementation.
Common Mistakes
| Mistake | Correction |
|---|---|
| Missing usage string or authorization gate | Add NSAlarmKitUsageDescription; handle denial before scheduling |
| Timer used for recurrence | Use an alarm with .weekly([...]) |
App-owned state replaces alarmUpdates | Observe the system sequence and reconcile by ID |
| Intents added for standard Stop/Snooze | Omit them unless cleanup/custom behavior requires one |
Large AlarmMetadata payload | Keep lightweight metadata or reference app data by ID |
Deprecated stopButton initializer | Use init(title:secondaryButton:secondaryButtonBehavior:) |
Review Checklist
- Setup and authorization gates pass without unsupported entitlement keys
- Alarm/timer choice, presentation, metadata, intents, snooze duration, and tint are valid
- Scheduled IDs are retained and reconciled through
alarmUpdates; operation errors are handled - Countdown uses the shared Widget Extension attributes and presentation state
- System-managed alert UI and adjacent-skill ownership follow the routing table
- Sound, vibration, Stop/Snooze, and state changes pass on-device testing
References
- Patterns and code: references/alarmkit-patterns.md
- Apple docs: AlarmKit | AlarmManager | AlarmAttributes | Scheduling an alarm
FAQ
What does the alarmkit skill do?
Implement AlarmKit alarms and countdown timers for iOS and iPadOS with Lock Screen, Dynamic Island, StandBy, and paired Apple Watch system UI. Covers AlarmManager scheduling, AlarmAttributes and AlarmPresentation, system Stop and AlarmButton secondary actions, authorization, state observation, countdown widget-extension handoff, and Live Activity integration. Use when building wake-up alarms, countdown timers, or alarm-style alerts that need Apple's system alarm experience.
How do I install alarmkit?
Run npx skills add https://github.com/dpearson2699/swift-ios-skills --skill alarmkit in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/alarmkit/ (personal) or .claude/skills/alarmkit/ (project).
Which AI agents can use alarmkit?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is alarmkit safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains alarmkit?
It is published by dpearson2699 in dpearson2699/swift-ios-skills. It has 3,625 recorded installs.
More from dpearson2699/swift-ios-skills
swiftui-animation
dpearson2699/swift-ios-skills
Implement, diagnose, or review SwiftUI motion using explicit and scoped implicit animations, springs, transitions, PhaseAnimator, KeyframeAnimator, matched geometry or navigation zoom, SF Symbol effects, and custom Animation types. Use when views should animate on state changes, insertion, removal, navigation, or multi-step choreography, or when motion must respect Reduce Motion and Swift concurrency.
ios-accessibility
dpearson2699/swift-ios-skills
Build and audit SwiftUI, UIKit, and AppKit accessibility for VoiceOver, Voice Control, Switch Control, Full Keyboard Access, Dynamic Type, focus restoration, labels/traits/actions, traversal, custom rotors, NSAccessibility, XCTest checks, adaptive system preferences, and App Store accessibility declarations. Use when implementing accessible UI, fixing an accessibility audit, testing assistive-technology behavior, or substantiating App Store Accessibility Nutrition Labels.
swiftui-performance
dpearson2699/swift-ios-skills
Profile, diagnose, and remediate SwiftUI runtime performance using code review, Instruments, and repeatable measurements. Use when a SwiftUI screen renders slowly, scrolling or animations hitch, view bodies update excessively, list identity churns, layout work spikes, or broad Observation dependencies raise CPU cost. Covers evidence-based triage, SwiftUI Instruments lanes, lazy-container guardrails, state lifetime, and before/after verification.
swiftui-patterns
dpearson2699/swift-ios-skills
Builds and reviews SwiftUI views with modern MV architecture, state, composition, isolated previews, and migration guidance. Covers @Observable ownership, @State/@Bindable/@Environment wiring, view decomposition, ViewModifiers, environment values, .task loading, iOS 26+ handoffs, Writing Tools, clipboard availability, and performance. Use when structuring SwiftUI state, managing @Observable, composing views, previewing meaningful UI states, or correcting SwiftUI patterns.
app-store-review
dpearson2699/swift-ios-skills
Audits App Store submission readiness and rejection risk across current review guidelines, PrivacyInfo.xcprivacy and required-reason APIs, privacy labels, ATT, StoreKit payments, metadata, entitlements, widgets, and Live Activities. Use when preparing a submission, responding to rejection, reconciling privacy evidence, or separating upload blockers from cleanup.
ios-networking
dpearson2699/swift-ios-skills
Build, review, or improve networking code in iOS/macOS apps using URLSession with async/await, structured concurrency, and modern Swift patterns. Use when working with REST APIs, downloading files, uploading data, WebSocket connections, pagination, retry logic, request middleware, caching, background transfers, or network reachability monitoring. Also use when handling HTTP requests, API clients, network error handling, or data fetching in Swift apps.
Popular mobile skills
design-mobile-apps
designed-by-ai/skills
Design mobile app screens with Sleek, edit Sleek projects, and implement their designs in React Native or HTML.
ios-design
uizze.sh
Design and review iOS UI/UX for iPhone apps in SwiftUI, UIKit, or React Native. Use for mobile app design, screen redesigns, navigation flows, typography, forms, keyboard and safe-area layout, and accessibility checks. Apply Apple Human Interface Guidelines and consult real product references through the optional Uizze connection.
vercel-react-native-skills
vercel-labs/agent-skills
React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.
animate-expo
emilkowalski/skills
Build animations in React Native and Expo, making the decisions in the order that determines whether they feel right — should it animate, which thread it runs on, which properties, spring or timing, how the gesture hands off, how it degrades. Writes the implementation with Reanimated, Gesture Handler, Expo Router and expo-haptics. Use when animating anything in an Expo app, adding gestures, sheets, screen transitions, press feedback or haptics, or fixing motion that stutters on device. For web animation use animate.
xcode-project-setup
firebase/agent-skills
Safely modifies Xcode projects (.pbxproj) to add Swift Packages and link files. Use this skill whenever an iOS project needs dependencies installed (e.g. Firebase, Alamofire).
firebase-remote-config-basics
firebase/agent-skills
Manages Firebase Remote Config templates, feature flags, loading strategies, and SDKs (Android, iOS). Use when downloading/deploying remoteconfig JSON templates, managing version history/feature flags, setting in-app defaults, fetchAndActivate(), real-time listeners, or SDK setup. Don't use for Firebase Hosting, Auth, Firestore, Data Connect, Crashlytics, or App Hosting.