Contents

schedule(id:configuration:)

Schedules a new alarm.

Declaration

func schedule<Metadata>(id: Alarm.ID, configuration: AlarmManager.AlarmConfiguration<Metadata>) async throws -> Alarm where Metadata : AlarmMetadata

Parameters

  • id:

    The alarm’s identifier.

  • configuration:

    The configuration for the new alarm.

Discussion

If scheduling a new alarm is successful, the function returns the Alarm structure. If you provide a countdownDuration, the system shows a countdown UI for the specified duration before the alarm alerts. If you provide a schedule, the alarm alerts at the scheduled time. If you provide both a countdownDuration and a schedule, the system shows a countdown UI before the alarm alerts, possibly on a repeating schedule. Define the ID to encode it into your intent.

See Also

Scheduling an alarm