What's New / App Services, Foundation & Diagnostics

What's new in AlarmKit

+1 NewiOS

AlarmKit is Apple's framework for scheduling and managing alarms and countdown timers. System presentation is handled through AlarmManager and its configuration types.

The 27 SDK adds one API and deprecates or removes nothing. The addition is AlarmManager.AlarmConfiguration, the type that describes an alarm's setup when scheduling through AlarmManager.

New

1
extension

AlarmManager.AlarmConfiguration

NewiOS
extension AlarmManager.AlarmConfiguration
Declaration
extension AlarmManager.AlarmConfiguration {

    /// Creates a configuration that behaves like a countdown.
    /// - Parameters:
    ///   - countdownDuration: The optional countdown duration. When
    ///   set to a non-nil value, a countdown shows in the Lock Screen for the specified duration.
    ///   - schedule: The schedule that determines when the alarm alerts.
    ///   - attributes: The attributes of the alarm.
    ///   - appEntityIdentifier: The entity associated with the alarm.
    ///   - stopIntent: The intent to execute when a person stops the countdown.
    ///   - secondaryIntent: The intent to execute when a person taps the secondary button.
    ///   - sound: The sound to play when the alarm fires.
    public init(countdownDuration: Alarm.CountdownDuration? = nil, schedule: Alarm.Schedule? = nil, attributes: AlarmAttributes<Metadata>, appEntityIdentifier: EntityIdentifier? = nil, stopIntent: (any LiveActivityIntent)? = nil, secondaryIntent: (any LiveActivityIntent)? = nil, sound: AlertConfiguration.AlertSound = .default)

    /// Creates a configuration that behaves like
    /// a traditional timer.
    ///
    /// The timer starts immediately, runs for `duration` seconds, and
    /// then alerts.  If you provide a secondary button with a behavior that indicates
    /// that the timer can repeat, the alert will have a repeat button.
    ///
    /// - Parameters:
    ///   - duration: The duration of the timer in seconds.
    ///   - attributes: The attributes to use when presenting the alert.
    ///   - appEntityIdentifier: The entity associated with the alarm.
    ///   - stopIntent: The intent to execute when a person stops the timer.
    ///   - secondaryIntent: The intent to execute when a person taps the secondary button.
    ///   - sound: The sound to play when the alarm fires.
    public static func timer(duration: TimeInterval, attributes: AlarmAttributes<Metadata>, appEntityIdentifier: EntityIdentifier? = nil, stopIntent: (any LiveActivityIntent)? = nil, secondaryIntent: (any LiveActivityIntent)? = nil, sound: AlertConfiguration.AlertSound = .default) -> AlarmManager.AlarmConfiguration<Metadata>

    /// Creates a configuration that behaves like
    /// a traditional alarm.
    ///
    /// At the scheduled time, based on the `schedule` parameter you supply,
    /// the alarm alerts.
    ///
    /// - Parameters:
    ///   - schedule: The schedule for the alarm.
    ///   - attributes: The attributes to use when presenting the alert.
    ///   - appEntityIdentifier: The entity associated with the alarm.
    ///   - stopIntent: The intent to execute when a person taps the stop button.
    ///   - secondaryIntent: The intent to execute when a person taps the secondary button.
    ///   - sound: The sound to play when the alarm fires.
    public static func alarm(schedule: Alarm.Schedule? = nil, attributes: AlarmAttributes<Metadata>, appEntityIdentifier: EntityIdentifier? = nil, stopIntent: (any LiveActivityIntent)? = nil, secondaryIntent: (any LiveActivityIntent)? = nil, sound: AlertConfiguration.AlertSound = .default) -> AlarmManager.AlarmConfiguration<Metadata>
}

No APIs match your filter.

← More in App Services, Foundation & Diagnostics