Contents

Alarm

An object that describes an alarm that can alert once or on a repeating schedule.

Declaration

struct Alarm

Overview

The following is an example of a 10 second timer:

let configuration = AlarmManager.AlarmConfiguration(
    countdownDuration: Alarm.CountdownDuration(preAlert: 10, postAlert: 10),
    schedule: nil,
    attributes: attributes,
    secondaryIntent: repeatIntent,
    sound: .default)

The following is an example of an alarm that includes a 9 minute snooze option and plays the default sound:

let configuration = AlarmManager.AlarmConfiguration(
    countdownDuration: Alarm.CountdownDuration(preAlert: nil, postAlert: 9 * 60),
    schedule: .relative(schedule),
    attributes: attributes,
    secondaryIntent: snoozeIntent,
    sound: .default)

Topics

Defining a countdown duration

Setting an alarm schedule

See Also

Alarm management