How to set up an Alarm using AlarmKit?

Asked on 06/12/2025

1 search

To set up an alarm using AlarmKit, you can follow these steps as outlined in the session "Wake up to the AlarmKit API" from WWDC 2025:

  1. Authorization: Before scheduling alarms, ensure your app has the necessary authorization. You can request authorization using the AlarmManager's Request Authorization API. Add NSAlarmKitUsageDescription to your app's info plist to explain why your app needs to use alarms.

  2. Create an Alarm:

    • Define the countdown duration and schedule. You can set a fixed schedule with a specific date or a relative schedule with a recurrence pattern.
    • Customize the alarm's appearance, including the alert title, buttons, and sounds. You can use the AlarmButton struct to define buttons like "Dismiss" or "Snooze".
    • Set up the alarm configuration with the countdown duration, schedule, and attributes.
  3. Manage Alarm Lifecycle: Use the AlarmManager class to manage the alarm's lifecycle. You can schedule, cancel, stop, pause, or resume alarms using their unique identifiers.

  4. Custom Actions: You can add custom actions to your alarms using app intents. For example, you can create a custom button that opens your app when tapped.

For a detailed walkthrough, you can refer to the session chapter on Creation (03:06) in the "Wake up to the AlarmKit API" session.

How to set up an Alarm using AlarmKit? | Ask WWDC