AlarmKit

The AlarmKit docs 8/19/25

Download

How to use this context:

  1. Click the "Copy Context" button above
  2. Paste it into your AI assistant conversation
  3. The AI will use this context to provide more accurate and relevant responses

https://developer.apple.com/documentation/AlarmKit

Framework

AlarmKit

Schedule prominent alarms and countdowns to help people manage their time.

Overview

Use AlarmKit to create custom alarms and timers in your app. AlarmKit provides a framework for managing alarms with customizable schedules and UI. It supports one-time and repeating alarms, with the option for countdown durations and snooze functionality. AlarmKit handles alarm authorization and provides UI for both templated and widget presentations. It supports traditional alarms, timers, or both, and provides methods to schedule, pause, resume, and cancel alarms.

Topics

Alarm management

Scheduling an alarm with AlarmKit

Create prominent alerts at specified dates for your iOS app.

class AlarmManager

An object that exposes functions to work with alarms: scheduling, snoozing, cancelling.

struct Alarm

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

Buttons

struct AlarmButton

A structure that defines the appearance of buttons.

Views

struct AlarmPresentation

An object that describes the content required for the alarm UI.

struct AlarmPresentationState

An object that describes the mutable content of the alarm.

struct AlarmAttributes

An object that contains all information necessary for the alarm UI.

protocol AlarmMetadata

A metadata object that contains information about an alarm.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/scheduling-an-alarm-with-alarmkit

  • AlarmKit
  • Scheduling an alarm with AlarmKit Beta

Sample Code

Scheduling an alarm with AlarmKit

Create prominent alerts at specified dates for your iOS app.

Download

Xcode 26.0+Beta

Overview

An alarm is an alert that presents at a pre-determined time based on a schedule or after a countdown. It overrides both a device’s focus and silent mode, if necessary.

This sample project uses AlarmKit to create and manage different types of alarms. In this app people can create and manage:

  • One-time alarms which alert only once at a specified time in the future.

  • Repeating alarms which alert with a weekly cadence.

  • Timers which alert after a countdown, and start immediately.

This project also includes a widget extension for setting up the custom countdown Live Activity associated with an alarm.

Authorize the app to schedule alarms

This sample prompts people to authorize the app to allow AlarmKit to schedule alarms and create alerts by calling requestAuthorization() on AlarmManager. Otherwise, when a person adds their first alarm, AlarmKit automatically requests this authorization on behalf of the app, before scheduling the alarm. If this sample doesn’t get this authorization, then any alarm created by the app isn’t scheduled and subsequently doesn’t alert.

do { let state = try await alarmManager.requestAuthorization() return state == .authorized } catch { print("Error occurred while requesting authorization: (error)") return false }

The sample includes the NSAlarmKitUsageDescription key in the app’s Info.plist with a descriptive string explaining why it schedules alarms. This string appears in the system prompt when requesting authorization, in this sample the string is:

We'll schedule alerts for alarms you create within our app.

If the NSAlarmKitUsageDescription key is missing or its value is an empty string, apps can’t schedule alarms with AlarmKit.

Create the alarm schedule

The sample app creates an alarm with either, or both, a countdown duration and a schedule, based on the options a person sets.

Alarm.CountdownDuration uses the selected TimeInterval for the pre-alert countdown, which displays the alert when the countdown reaches 0.

Alarm.Schedule enables people to set a one-time alarm, or configure a weekly schedule. For single-occurrence alarms, the repeats property is set to Alarm.Schedule.Relative.Recurrence.never. For recurring alarms, the repeats property is set to Alarm.Schedule.Relative.Recurrence.weekly(_:) with an associated array Locale.Weekday, indicating the days of the week the alarm alerts.

let time = Alarm.Schedule.Relative.Time(hour: hour, minute: minute) return .relative(.init( time: time, repeats: weekdays.isEmpty ? .never : .weekly(Array(weekdays)) ))

Configure the alarm’s UI attributes

AlarmKit provides a presentation for each of the three alarm states - AlarmPresentation.Alert, AlarmPresentation.Countdown, and AlarmPresentation.Paused. Because Countdown and Paused are optional presentations, this sample doesn’t use them if the alarm only has an Alert state.

let alertContent = AlarmPresentation.Alert(title: userInput.localizedLabel, stopButton: .stopButton, secondaryButton: secondaryButton, secondaryButtonBehavior: secondaryButtonBehavior)

guard userInput.countdownDuration != nil else { // An alarm without countdown specifies only an alert state. return AlarmPresentation(alert: alertContent) }

// With countdown enabled, provide a presentation for both a countdown and paused state. let countdownContent = AlarmPresentation.Countdown(title: userInput.localizedLabel, pauseButton: .pauseButton)

let pausedContent = AlarmPresentation.Paused(title: "Paused", resumeButton: .resumeButton)

return AlarmPresentation(alert: alertContent, countdown: countdownContent, paused: pausedContent)

Alongside the stopButton, the sample includes another action button in the alerting UI. This action depends on secondaryButton and secondaryButtonBehavior.

var secondaryButtonBehavior: AlarmPresentation.Alert.SecondaryButtonBehavior? { switch selectedSecondaryButton { case .none: nil case .countdown: .countdown case .openApp: .custom } }

When the secondaryButtonBehavior property is set to AlarmPresentation.Alert.SecondaryButtonBehavior.countdown, the secondary button is a Repeat action, which re-triggers the alarm after a certain TimeInterval, as specified in postAlert. If the secondaryButtonBehavior is set to AlarmPresentation.Alert.SecondaryButtonBehavior.custom, the alarm alert displays an Open action to launch the app.

let secondaryButton: AlarmButton? = switch secondaryButtonBehavior { case .countdown: .repeatButton case .custom: .openAppButton default: nil }

The content for these presentations is wrapped into ActivityAttributes, along with tintColor, and metadata. The tint color associates the alarms with the sample app and also differentiates them from other app’s alarms on the person’s device.

let attributes = AlarmAttributes(presentation: alarmPresentation(with: userInput), metadata: CookingData(), tintColor: Color.blue)

Schedule the configured alarm

The sample uses a unique identifier to track alarms registered with AlarmKit. The sample manages and updates alarm states, such as pause(id:) and cancel(id:), using this identifier.

When a person taps the button in the alerting UI, the AlarmManager automatically handles stop or countdown functionalities, depending on the button type.

let id = UUID() let alarmConfiguration = AlarmConfiguration(countdownDuration: userInput.countdownDuration, schedule: userInput.schedule, attributes: attributes, stopIntent: StopIntent(alarmID: id.uuidString), secondaryIntent: secondaryIntent(alarmID: id, userInput: userInput))

This sample creates the alarm ID and AlarmManager.AlarmConfiguration and schedules the alarm with AlarmManager.

let alarm = try await alarmManager.schedule(id: id, configuration: alarmConfiguration)

Observe state changes on the alarms

At initialization, the ViewModel subscribes to alarm events from shared. This enables the sample app to have the latest state of an alarm even if the alarm state updated while the sample app isn’t running.

Task { for await incomingAlarms in alarmManager.alarmUpdates { updateAlarmState(with: incomingAlarms) } }

Create a Widget Extension for Live Activities

The sample app adds a widget extension target to customize non-alerting presentations in the Dynamic Island, Lock Screen, and StandBy. The widget extension receives the same AlarmAttributes structure that you provide to shared when scheduling alarms. It includes the metadata provided in the Configure the alarm’s UI attributes section above.

See Also

Alarm management

class AlarmManager

An object that exposes functions to work with alarms: scheduling, snoozing, cancelling.

Beta

struct Alarm

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

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmmanager

  • AlarmKit
  • AlarmManager Beta

Class

AlarmManager

An object that exposes functions to work with alarms: scheduling, snoozing, cancelling.

class AlarmManager

Overview

Schedule your alarm alert using AlarmManager. The following example calls the AlarmManager schedule function by passing in the id and configuration.

Task { let _ = try? await AlarmManager.shared.schedule(id: id, configuration: configuration) }

Topics

Creating a shared instance

static let shared: AlarmManager

The singleton instance for interacting with the alarm system.

Updating an alarm

struct AlarmUpdates

An async sequence that publishes whenever an alarm changes.

An asynchronous sequence that emits events when the set of alarms changes.

var alarms: [Alarm]

Fetches all alarms from the daemon that belong to the current client.

Scheduling an alarm

Schedules a new alarm.

struct AlarmConfiguration

An object that contains all the properties necessary to schedule an alarm.

Requesting authorization

Requests permission to use the alarm system if it hasn’t been requested before.

Checking authorization status

struct AlarmAuthorizationStateUpdates

An asynchronous sequence that publishes a new value when authorization for the alarms and timers system changes.

An asynchronous sequence that emits events when authorization to use alarms changes.

enum AuthorizationState

An enumeration describing all authorization states for the client process.

var authorizationState: AlarmManager.AuthorizationState

Returns the current authorization state for this client.

Changing an alarm state

func cancel(id: Alarm.ID) throws

Cancels the alarm with the specified ID.

func countdown(id: Alarm.ID) throws

Performs a countdown for the alarm with the specified ID if it’s currently alerting.

func pause(id: Alarm.ID) throws

Pauses the alarm with the specified ID if it’s in the countdown state.

func resume(id: Alarm.ID) throws

Resumes the alarm with the specified ID if it’s in the paused state.

func stop(id: Alarm.ID) throws

Stops the alarm with the specified ID.

Throwing an error

enum AlarmError

An error that occurs when trying to schedule a timer.

See Also

Alarm management

Scheduling an alarm with AlarmKit

Create prominent alerts at specified dates for your iOS app.

struct Alarm

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

Beta

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarm

  • AlarmKit
  • Alarm Beta

Structure

Alarm

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

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

struct CountdownDuration

An object that defines the durations used in an alarm that has a countdown.

var countdownDuration: Alarm.CountdownDuration?

The time left before an alert, in seconds.

var id: UUID

The unique identifier of the alarm.

enum State

An enum that lists all possible states of an alarm.

var state: Alarm.State

The current state of the alarm.

Setting an alarm schedule

enum Schedule

A list of all types of schedules that the framework supports.

var schedule: Alarm.Schedule?

The schedule determines when the alarm alerts.

Relationships

Conforms To

  • Decodable
  • Encodable
  • Identifiable
  • Sendable
  • SendableMetatype

See Also

Alarm management

Scheduling an alarm with AlarmKit

Create prominent alerts at specified dates for your iOS app.

class AlarmManager

An object that exposes functions to work with alarms: scheduling, snoozing, cancelling.

Beta

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmbutton

  • AlarmKit
  • AlarmButton Beta

Structure

AlarmButton

A structure that defines the appearance of buttons.

struct AlarmButton

Overview

The folllowing example uses AlarmButton to define the appearance of the alarm.

let alert = AlarmPresentation.Alert(title: "Eggs are ready!", stopButton: AlarmButton (text: "Stop", textColor: .blue, systemImageName: "stop.circle"), secondaryButton: AlarmButton (text: "Repeat", textColor: .blue, systemImageName: "repeat"), secondaryButtonBehavior: .countdown)

Topics

Creating a button

init(text: LocalizedStringResource, textColor: Color, systemImageName: String)

Creates an alarm button.

var systemImageName: String

The name of the icon you use on the button.

var textColor: Color

The color for the text on the button.

var text: LocalizedStringResource

Text to show in a label on the button.

Encoding and decoding

func encode(to: any Encoder) throws

Performs encoding to a given encoder.

init(from: any Decoder) throws

Creates an alarm button from a decoder.

Relationships

Conforms To

  • Decodable
  • Encodable
  • Sendable
  • SendableMetatype

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmpresentation

  • AlarmKit
  • AlarmPresentation Beta

Structure

AlarmPresentation

An object that describes the content required for the alarm UI.

struct AlarmPresentation

Overview

The following example shows how to set different views for an alarm using the AlarmPresentation model.

let alert = AlarmPresentation.Alert(title: "Eggs are ready!", stopButton: AlarmButton(text: "Stop", textColor: .blue, systemImageName: "stop.circle"), secondaryButton: AlarmButton(text: "Repeat", textColor: .blue, systemImageName: "repeat"), secondaryButtonBehavior: .countdown)

let countdown = AlarmPresentation.Countdown(title: "Eggs are cooking")

let paused = AlarmPresentation.Paused(title: "Timer paused", resumeButton: AlarmButton(text: "Resume", textColor: .blue, systemImageName:"play.circle"))

let presentation = AlarmPresentation(alert: alert, countdown: countdown, paused: paused)

Topics

Defining the alarm UI

init(alert: AlarmPresentation.Alert, countdown: AlarmPresentation.Countdown?, paused: AlarmPresentation.Paused?)

Configures an alert with an optional countdown and paused state.

var alert: AlarmPresentation.Alert

The content for the alert mode of the alarm.

var countdown: AlarmPresentation.Countdown?

The content for the snooze or countdown mode of the alarm.

var paused: AlarmPresentation.Paused?

The content for the pause mode of the alarm.

Describing an alarm state

struct Alert

An object that describes the UI of the alert that appears when an alarm fires.

struct Countdown

An object that describes the content required for the countdown UI.

struct Paused

An object that describes the content required for the paused UI.

Relationships

Conforms To

  • Decodable
  • Encodable
  • Sendable
  • SendableMetatype

See Also

Views

struct AlarmPresentationState

An object that describes the mutable content of the alarm.

Beta

struct AlarmAttributes

An object that contains all information necessary for the alarm UI.

protocol AlarmMetadata

A metadata object that contains information about an alarm.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmpresentationstate

  • AlarmKit
  • AlarmPresentationState Beta

Structure

AlarmPresentationState

An object that describes the mutable content of the alarm.

struct AlarmPresentationState

Overview

This structure includes alerting, countdown, and paused states. Live Activities consists of two types of information: immutable attributes and mutable content. For example, in a live activity that’s showing the score of a soccer game the immutable attributes are the names of the teams involved in the game and the mutable content is the current score.

For alarms, immutable content is information you supply through your own processes, including information such as the tint color and the snooze button label. While mutable content comes from AlarmKit and contains information from the system, such as the alarm alert date and the alarm mode.

Topics

Creating an alarm state

init(alarmID: Alarm.ID, mode: AlarmPresentationState.Mode)

Creates an instance of an alarm state.

var alarmID: Alarm.ID

The unique ID of the alarm.

var mode: AlarmPresentationState.Mode

The specific state of the alarm, either alerting, countdown, or paused.

enum Mode

A list of all modes the alarm can be in: either alert, countdown, or paused.

Relationships

Conforms To

  • Decodable
  • Encodable
  • Equatable
  • Hashable
  • Sendable
  • SendableMetatype

See Also

Views

struct AlarmPresentation

An object that describes the content required for the alarm UI.

Beta

struct AlarmAttributes

An object that contains all information necessary for the alarm UI.

protocol AlarmMetadata

A metadata object that contains information about an alarm.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmattributes

  • AlarmKit
  • AlarmAttributes Beta

Structure

AlarmAttributes

An object that contains all information necessary for the alarm UI.

Overview

Provide all the information for the alarm up-front. At widget archiving time, the widget extension can choose which state to provide based on the mode in the AlarmPresentationState activity content state payload. The following example defines the attributes for the alarm UI.

let attributes = AlarmAttributes(presentation: presentation, metadata: metadata, tintColor: Color.white)

Topics

Creating an alarm attribute

init(presentation: AlarmPresentation, metadata: Metadata?, tintColor: Color)

Creates an instance of an alarm UI.

var tintColor: Color

The tint color applied to the templated UI.

var presentation: AlarmPresentation

The content required for the various states of the UI.

var metadata: Metadata?

The additional data you can include in your attributes.

typealias ContentState

The type alias for the structure that describes the content of an alarm.

Decoding and encoding

init(from: any Decoder) throws

Creates an instance from the given decoder.

func encode(to: any Encoder) throws

Performs encoding of the value using the given encoder.

Relationships

Conforms To

  • ActivityAttributes
  • Decodable
  • Encodable
  • Sendable
  • SendableMetatype

See Also

Views

struct AlarmPresentation

An object that describes the content required for the alarm UI.

Beta

struct AlarmPresentationState

An object that describes the mutable content of the alarm.

protocol AlarmMetadata

A metadata object that contains information about an alarm.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmmetadata

  • AlarmKit
  • AlarmMetadata Beta

Protocol

AlarmMetadata

A metadata object that contains information about an alarm.

protocol AlarmMetadata : Decodable, Encodable, Hashable, Sendable

Overview

Provide an implementation of this for your own custom content or other information. The implementation can be empty if you don’t want to provide any additional data for your alarm UI.

Relationships

Inherits From

  • Decodable
  • Encodable
  • Equatable
  • Hashable
  • Sendable
  • SendableMetatype

See Also

Views

struct AlarmPresentation

An object that describes the content required for the alarm UI.

Beta

struct AlarmPresentationState

An object that describes the mutable content of the alarm.

struct AlarmAttributes

An object that contains all information necessary for the alarm UI.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/scheduling-an-alarm-with-alarmkit)


https://developer.apple.com/documentation/alarmkit/alarmmanager)


https://developer.apple.com/documentation/alarmkit/alarm)


https://developer.apple.com/documentation/alarmkit/alarmbutton)


https://developer.apple.com/documentation/alarmkit/alarmpresentation)


https://developer.apple.com/documentation/alarmkit/alarmpresentationstate)


https://developer.apple.com/documentation/alarmkit/alarmattributes)


https://developer.apple.com/documentation/alarmkit/alarmmetadata)


https://developer.apple.com/documentation/alarmkit

Framework

AlarmKit

Schedule prominent alarms and countdowns to help people manage their time.

Overview

Use AlarmKit to create custom alarms and timers in your app. AlarmKit provides a framework for managing alarms with customizable schedules and UI. It supports one-time and repeating alarms, with the option for countdown durations and snooze functionality. AlarmKit handles alarm authorization and provides UI for both templated and widget presentations. It supports traditional alarms, timers, or both, and provides methods to schedule, pause, resume, and cancel alarms.

Topics

Alarm management

Scheduling an alarm with AlarmKit

Create prominent alerts at specified dates for your iOS app.

class AlarmManager

An object that exposes functions to work with alarms: scheduling, snoozing, cancelling.

struct Alarm

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

Buttons

struct AlarmButton

A structure that defines the appearance of buttons.

Views

struct AlarmPresentation

An object that describes the content required for the alarm UI.

struct AlarmPresentationState

An object that describes the mutable content of the alarm.

struct AlarmAttributes

An object that contains all information necessary for the alarm UI.

protocol AlarmMetadata

A metadata object that contains information about an alarm.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmmanager/shared

  • AlarmKit
  • AlarmManager
  • shared Beta

Type Property

shared

The singleton instance for interacting with the alarm system.

static let shared: AlarmManager

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmmanager/alarmupdates-swift.struct

  • AlarmKit
  • AlarmManager
  • AlarmManager.AlarmUpdates Beta

Structure

AlarmManager.AlarmUpdates

An async sequence that publishes whenever an alarm changes.

struct AlarmUpdates

Topics

Creating an iterator

struct Iterator

A nested type that iterates over the elements of this sequence.

Returns an asynchronous iterator over the elements of this sequence.

typealias Element

A type representing the sequence’s elements.

Relationships

Conforms To

  • AsyncSequence

See Also

Updating an alarm

An asynchronous sequence that emits events when the set of alarms changes.

Beta

var alarms: [Alarm]

Fetches all alarms from the daemon that belong to the current client.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmmanager/alarmupdates-swift.property

  • AlarmKit
  • AlarmManager
  • alarmUpdates Beta

Instance Property

alarmUpdates

An asynchronous sequence that emits events when the set of alarms changes.

Discussion

Use this to receive a notification when an alarm alerts, snoozes, or dismisses.

See Also

Updating an alarm

struct AlarmUpdates

An async sequence that publishes whenever an alarm changes.

Beta

var alarms: [Alarm]

Fetches all alarms from the daemon that belong to the current client.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmmanager/schedule(id:configuration:)

#app-main)

  • AlarmKit
  • AlarmManager
  • schedule(id:configuration:) Beta

Instance Method

schedule(id:configuration:)

Schedules a new alarm.

id: Alarm.ID,

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

struct AlarmConfiguration

An object that contains all the properties necessary to schedule an alarm.

Beta

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmmanager/alarmconfiguration

  • AlarmKit
  • AlarmManager
  • AlarmManager.AlarmConfiguration Beta

Structure

AlarmManager.AlarmConfiguration

An object that contains all the properties necessary to schedule an alarm.

Overview

Pass the schedule or countdown and any attributes you define to the AlarmConfiguration for the system to schedule. You can pass in an optional secondary intent that the system executes when a person taps a secondary button. This is only available after first unlock. You can also include custom sounds for your alarm.

The following example configures an alarm with a countdown duration.

let configuration = AlarmManager.AlarmConfiguration(countdownDuration: Alarm.CountdownDuration(preAlert: 10, postAlert: 10), schedule: nil, attributes: attributes, secondaryIntent: repeatIntent, alertConfiguration: AlertConfiguration(title: "Eggs are ready!", body: "Time to eat!", sound: .default))

Topics

Configuring a scheduled alarm

Creates a configuration that behaves like a traditional alarm.

Configuring a countdown

Creates a configuration that behaves like a countdown.

Creates a configuration that behaves like a traditional timer.

See Also

Scheduling an alarm

Schedules a new alarm.

Beta

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmmanager/requestauthorization()

#app-main)

  • AlarmKit
  • AlarmManager
  • requestAuthorization() Beta

Instance Method

requestAuthorization()

Requests permission to use the alarm system if it hasn’t been requested before.

Discussion

If a person using your app denies authorization, all attempts to schedule alarms fail.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmmanager/alarmauthorizationstateupdates

  • AlarmKit
  • AlarmManager
  • AlarmManager.AlarmAuthorizationStateUpdates Beta

Structure

AlarmManager.AlarmAuthorizationStateUpdates

An asynchronous sequence that publishes a new value when authorization for the alarms and timers system changes.

struct AlarmAuthorizationStateUpdates

Topics

Iterating an update

struct Iterator

A nested type that iterates over the elements of this sequence.

Returns an asynchronous iterator over the elements of this sequence.

typealias Element

A type representing the sequence’s elements.

Relationships

Conforms To

  • AsyncSequence

See Also

Checking authorization status

An asynchronous sequence that emits events when authorization to use alarms changes.

Beta

enum AuthorizationState

An enumeration describing all authorization states for the client process.

var authorizationState: AlarmManager.AuthorizationState

Returns the current authorization state for this client.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmmanager/authorizationupdates

  • AlarmKit
  • AlarmManager
  • authorizationUpdates Beta

Instance Property

authorizationUpdates

An asynchronous sequence that emits events when authorization to use alarms changes.

See Also

Checking authorization status

struct AlarmAuthorizationStateUpdates

An asynchronous sequence that publishes a new value when authorization for the alarms and timers system changes.

Beta

enum AuthorizationState

An enumeration describing all authorization states for the client process.

var authorizationState: AlarmManager.AuthorizationState

Returns the current authorization state for this client.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmmanager/authorizationstate-swift.enum

  • AlarmKit
  • AlarmManager
  • AlarmManager.AuthorizationState Beta

Enumeration

AlarmManager.AuthorizationState

An enumeration describing all authorization states for the client process.

enum AuthorizationState

Topics

Describing an authorization state

case authorized

The person authorized the client to use alarms and timers.

case denied

The client previously requested authorization from the person, but they declined.

case notDetermined

The client hasn’t requested authorization from a person.

Relationships

Conforms To

  • Copyable
  • Decodable
  • Encodable
  • Equatable
  • Hashable
  • Sendable
  • SendableMetatype

See Also

Checking authorization status

struct AlarmAuthorizationStateUpdates

An asynchronous sequence that publishes a new value when authorization for the alarms and timers system changes.

Beta

An asynchronous sequence that emits events when authorization to use alarms changes.

var authorizationState: AlarmManager.AuthorizationState

Returns the current authorization state for this client.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmmanager/authorizationstate-swift.property

  • AlarmKit
  • AlarmManager
  • authorizationState Beta

Instance Property

authorizationState

Returns the current authorization state for this client.

var authorizationState: AlarmManager.AuthorizationState { get }

See Also

Checking authorization status

struct AlarmAuthorizationStateUpdates

An asynchronous sequence that publishes a new value when authorization for the alarms and timers system changes.

Beta

An asynchronous sequence that emits events when authorization to use alarms changes.

enum AuthorizationState

An enumeration describing all authorization states for the client process.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmmanager/cancel(id:)

#app-main)

  • AlarmKit
  • AlarmManager
  • cancel(id:) Beta

Instance Method

cancel(id:)

Cancels the alarm with the specified ID.

func cancel(id: Alarm.ID) throws

Parameters

id

The identifier of the alarm to cancel.

Discussion

Deletes the alarm from the system even if the alarm has a repeating schedule.

See Also

Changing an alarm state

func countdown(id: Alarm.ID) throws

Performs a countdown for the alarm with the specified ID if it’s currently alerting.

Beta

func pause(id: Alarm.ID) throws

Pauses the alarm with the specified ID if it’s in the countdown state.

func resume(id: Alarm.ID) throws

Resumes the alarm with the specified ID if it’s in the paused state.

func stop(id: Alarm.ID) throws

Stops the alarm with the specified ID.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmmanager/countdown(id:)

#app-main)

  • AlarmKit
  • AlarmManager
  • countdown(id:) Beta

Instance Method

countdown(id:)

Performs a countdown for the alarm with the specified ID if it’s currently alerting.

func countdown(id: Alarm.ID) throws

Parameters

id

The identifier of the alarm to perform a countdown for.

Discussion

The function throws otherwise. This is identical to the repeat function of a timer, or the snooze function of an alarm.

See Also

Changing an alarm state

func cancel(id: Alarm.ID) throws

Cancels the alarm with the specified ID.

Beta

func pause(id: Alarm.ID) throws

Pauses the alarm with the specified ID if it’s in the countdown state.

func resume(id: Alarm.ID) throws

Resumes the alarm with the specified ID if it’s in the paused state.

func stop(id: Alarm.ID) throws

Stops the alarm with the specified ID.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmmanager/pause(id:)

#app-main)

  • AlarmKit
  • AlarmManager
  • pause(id:) Beta

Instance Method

pause(id:)

Pauses the alarm with the specified ID if it’s in the countdown state.

func pause(id: Alarm.ID) throws

Parameters

id

The identifier of the alarm to pause.

Discussion

The function throws otherwise. Sets the alarm to the AlarmPresentationState.Mode.paused(_:) state.

See Also

Changing an alarm state

func cancel(id: Alarm.ID) throws

Cancels the alarm with the specified ID.

Beta

func countdown(id: Alarm.ID) throws

Performs a countdown for the alarm with the specified ID if it’s currently alerting.

func resume(id: Alarm.ID) throws

Resumes the alarm with the specified ID if it’s in the paused state.

func stop(id: Alarm.ID) throws

Stops the alarm with the specified ID.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmmanager/resume(id:)

#app-main)

  • AlarmKit
  • AlarmManager
  • resume(id:) Beta

Instance Method

resume(id:)

Resumes the alarm with the specified ID if it’s in the paused state.

func resume(id: Alarm.ID) throws

Parameters

id

The identifier of the alarm to resume.

Discussion

The function throws otherwise. Sets the alarm to the AlarmPresentationState.Mode.Countdown state

See Also

Changing an alarm state

func cancel(id: Alarm.ID) throws

Cancels the alarm with the specified ID.

Beta

func countdown(id: Alarm.ID) throws

Performs a countdown for the alarm with the specified ID if it’s currently alerting.

func pause(id: Alarm.ID) throws

Pauses the alarm with the specified ID if it’s in the countdown state.

func stop(id: Alarm.ID) throws

Stops the alarm with the specified ID.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmmanager/stop(id:)

#app-main)

  • AlarmKit
  • AlarmManager
  • stop(id:) Beta

Instance Method

stop(id:)

Stops the alarm with the specified ID.

func stop(id: Alarm.ID) throws

Parameters

id

The identifier of the alarm to stop.

Discussion

If the alarm is a one-shot, meaning it doesn’t have a repeating schedule, then the system deletes the alarm. If the alarm repeats then it’s rescheduled to alert or begins counting down at the next scheduled time.

See Also

Changing an alarm state

func cancel(id: Alarm.ID) throws

Cancels the alarm with the specified ID.

Beta

func countdown(id: Alarm.ID) throws

Performs a countdown for the alarm with the specified ID if it’s currently alerting.

func pause(id: Alarm.ID) throws

Pauses the alarm with the specified ID if it’s in the countdown state.

func resume(id: Alarm.ID) throws

Resumes the alarm with the specified ID if it’s in the paused state.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmmanager/alarmerror

  • AlarmKit
  • AlarmManager
  • AlarmManager.AlarmError Beta

Enumeration

AlarmManager.AlarmError

An error that occurs when trying to schedule a timer.

enum AlarmError

Topics

Checking for alarm limit

case maximumLimitReached

A maximum number of alarms is already scheduled.

Relationships

Conforms To

  • Copyable
  • Equatable
  • Error
  • Hashable
  • Sendable
  • SendableMetatype

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmmanager/shared)


https://developer.apple.com/documentation/alarmkit/alarmmanager/alarmupdates-swift.struct)

The page you're looking for can't be found.

Search developer.apple.comSearch Icon


https://developer.apple.com/documentation/alarmkit/alarmmanager/alarmupdates-swift.property)

The page you're looking for can't be found.

Search developer.apple.comSearch Icon


https://developer.apple.com/documentation/alarmkit/alarmmanager/alarms)


https://developer.apple.com/documentation/alarmkit/alarmmanager/schedule(id:configuration:))

)#app-main)

The page you're looking for can't be found.

Search developer.apple.comSearch Icon


https://developer.apple.com/documentation/alarmkit/alarmmanager/alarmconfiguration)


https://developer.apple.com/documentation/alarmkit/alarmmanager/requestauthorization())

)#app-main)

The page you're looking for can't be found.

Search developer.apple.comSearch Icon


https://developer.apple.com/documentation/alarmkit/alarmmanager/alarmauthorizationstateupdates)

The page you're looking for can't be found.

Search developer.apple.comSearch Icon


https://developer.apple.com/documentation/alarmkit/alarmmanager/authorizationupdates)


https://developer.apple.com/documentation/alarmkit/alarmmanager/authorizationstate-swift.enum)

The page you're looking for can't be found.

Search developer.apple.comSearch Icon


https://developer.apple.com/documentation/alarmkit/alarmmanager/authorizationstate-swift.property)

The page you're looking for can't be found.

Search developer.apple.comSearch Icon


https://developer.apple.com/documentation/alarmkit/alarmmanager/cancel(id:))


https://developer.apple.com/documentation/alarmkit/alarmmanager/countdown(id:))


https://developer.apple.com/documentation/alarmkit/alarmmanager/pause(id:))


https://developer.apple.com/documentation/alarmkit/alarmmanager/resume(id:))


https://developer.apple.com/documentation/alarmkit/alarmmanager/stop(id:))


https://developer.apple.com/documentation/alarmkit/alarmmanager/alarmerror)


https://developer.apple.com/documentation/alarmkit/alarmpresentation/init(alert:countdown:paused:)

#app-main)

  • AlarmKit
  • AlarmPresentation
  • init(alert:countdown:paused:) Beta

Initializer

init(alert:countdown:paused:)

Configures an alert with an optional countdown and paused state.

init( alert: AlarmPresentation.Alert, countdown: AlarmPresentation.Countdown? = nil, paused: AlarmPresentation.Paused? = nil )

Parameters

alert

The required content for the alert mode of the alarm.

countdown

An optional parameter with a default nil value. Provide a AlarmPresentation.Countdown object.

paused

An optional parameter with a default nil value. Provide a AlarmPresentation.Paused object.

See Also

Defining the alarm UI

var alert: AlarmPresentation.Alert

The content for the alert mode of the alarm.

Beta

var countdown: AlarmPresentation.Countdown?

The content for the snooze or countdown mode of the alarm.

var paused: AlarmPresentation.Paused?

The content for the pause mode of the alarm.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmpresentation/alert-swift.property

  • AlarmKit
  • AlarmPresentation
  • alert Beta

Instance Property

alert

The content for the alert mode of the alarm.

var alert: AlarmPresentation.Alert

See Also

Defining the alarm UI

init(alert: AlarmPresentation.Alert, countdown: AlarmPresentation.Countdown?, paused: AlarmPresentation.Paused?)

Configures an alert with an optional countdown and paused state.

Beta

var countdown: AlarmPresentation.Countdown?

The content for the snooze or countdown mode of the alarm.

var paused: AlarmPresentation.Paused?

The content for the pause mode of the alarm.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmpresentation/countdown-swift.property

  • AlarmKit
  • AlarmPresentation
  • countdown Beta

Instance Property

countdown

The content for the snooze or countdown mode of the alarm.

var countdown: AlarmPresentation.Countdown?

Discussion

This value can be nil if the alarm doesn’t support countdown mode.

See Also

Defining the alarm UI

init(alert: AlarmPresentation.Alert, countdown: AlarmPresentation.Countdown?, paused: AlarmPresentation.Paused?)

Configures an alert with an optional countdown and paused state.

Beta

var alert: AlarmPresentation.Alert

The content for the alert mode of the alarm.

var paused: AlarmPresentation.Paused?

The content for the pause mode of the alarm.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmpresentation/paused-swift.property

  • AlarmKit
  • AlarmPresentation
  • paused Beta

Instance Property

paused

The content for the pause mode of the alarm.

var paused: AlarmPresentation.Paused?

Discussion

This value can be nil if the alarm doesn’t support pause mode.

See Also

Defining the alarm UI

init(alert: AlarmPresentation.Alert, countdown: AlarmPresentation.Countdown?, paused: AlarmPresentation.Paused?)

Configures an alert with an optional countdown and paused state.

Beta

var alert: AlarmPresentation.Alert

The content for the alert mode of the alarm.

var countdown: AlarmPresentation.Countdown?

The content for the snooze or countdown mode of the alarm.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmpresentation/alert-swift.struct

  • AlarmKit
  • AlarmPresentation
  • AlarmPresentation.Alert Beta

Structure

AlarmPresentation.Alert

An object that describes the UI of the alert that appears when an alarm fires.

struct Alert

Overview

Alert configures the title and buttons in the alarm UI. Use this object to define your alarm button behaviors. The code snippet below describes how to configure an Alert button.

let alert = AlarmPresentation.Alert(title: "Eggs are ready!", stopButton: AlarmButton(text: "Stop", textColor: .blue, systemImageName: "stop.circle"), secondaryButton: AlarmButton(text: "Repeat", textColor: .blue, systemImageName: "repeat"), secondaryButtonBehavior: .countdown)

Topics

Creating a button

init(title: LocalizedStringResource, stopButton: AlarmButton, secondaryButton: AlarmButton?, secondaryButtonBehavior: AlarmPresentation.Alert.SecondaryButtonBehavior?)

Creates an alert for an alarm.

var stopButton: AlarmButton

The appearance of the stop button.

var title: LocalizedStringResource

The title of the alert.

Creating a second button

var secondaryButton: AlarmButton?

The appearance of the secondary button.

var secondaryButtonBehavior: AlarmPresentation.Alert.SecondaryButtonBehavior?

The behavior of the second button.

enum SecondaryButtonBehavior

Describes the behaviour of the second button.

Relationships

Conforms To

  • Decodable
  • Encodable
  • Sendable
  • SendableMetatype

See Also

Describing an alarm state

struct Countdown

An object that describes the content required for the countdown UI.

Beta

struct Paused

An object that describes the content required for the paused UI.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmpresentation/countdown-swift.struct

  • AlarmKit
  • AlarmPresentation
  • AlarmPresentation.Countdown Beta

Structure

AlarmPresentation.Countdown

An object that describes the content required for the countdown UI.

struct Countdown

Overview

The code snippet below describes how to configure a countdown UI with a pause and resume button.

let countdown = AlarmPresentation.Countdown (title: "Eggs are cooking") let paused = AlarmPresentation.Paused (title: "Timer paused", resumeButton: AlarmButton (text: "Resume", textColor: .blue, systemImageName:"play.circle"))

Topics

Creates a pause button

init(title: LocalizedStringResource, pauseButton: AlarmButton?)

Creates a countdown with an optional pause button.

var pauseButton: AlarmButton?

The pause button for a countdown timer.

var title: LocalizedStringResource

The title of the countdown.

Relationships

Conforms To

  • Decodable
  • Encodable
  • Sendable
  • SendableMetatype

See Also

Describing an alarm state

struct Alert

An object that describes the UI of the alert that appears when an alarm fires.

Beta

struct Paused

An object that describes the content required for the paused UI.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmpresentation/paused-swift.struct

  • AlarmKit
  • AlarmPresentation
  • AlarmPresentation.Paused Beta

Structure

AlarmPresentation.Paused

An object that describes the content required for the paused UI.

struct Paused

Overview

This is only applicable to timers that can be paused. To get

Creating a resume button

init(title: LocalizedStringResource, resumeButton: AlarmButton)

Creates a pause presentation with a resume button.

var resumeButton: AlarmButton

The appearance of the resume button.

var title: LocalizedStringResource

The title of the paused UI.

Relationships

Conforms To

  • Decodable
  • Encodable
  • Sendable
  • SendableMetatype

See Also

Describing an alarm state

struct Alert

An object that describes the UI of the alert that appears when an alarm fires.

Beta

struct Countdown

An object that describes the content required for the countdown UI.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmpresentation/init(alert:countdown:paused:))

)#app-main)

The page you're looking for can't be found.

Search developer.apple.comSearch Icon


https://developer.apple.com/documentation/alarmkit/alarmpresentation/alert-swift.property)

The page you're looking for can't be found.

Search developer.apple.comSearch Icon


https://developer.apple.com/documentation/alarmkit/alarmpresentation/countdown-swift.property)

The page you're looking for can't be found.

Search developer.apple.comSearch Icon


https://developer.apple.com/documentation/alarmkit/alarmpresentation/paused-swift.property)

The page you're looking for can't be found.

Search developer.apple.comSearch Icon


https://developer.apple.com/documentation/alarmkit/alarmpresentation/alert-swift.struct)

The page you're looking for can't be found.

Search developer.apple.comSearch Icon


https://developer.apple.com/documentation/alarmkit/alarmpresentation/countdown-swift.struct)

The page you're looking for can't be found.

Search developer.apple.comSearch Icon


https://developer.apple.com/documentation/alarmkit/alarmpresentation/paused-swift.struct)

The page you're looking for can't be found.

Search developer.apple.comSearch Icon


https://developer.apple.com/documentation/alarmkit/alarm/countdownduration-swift.struct

  • AlarmKit
  • Alarm
  • Alarm.CountdownDuration Beta

Structure

Alarm.CountdownDuration

An object that defines the durations used in an alarm that has a countdown.

struct CountdownDuration

Overview

Provide the countdown duration in seconds.

Alarm.CountdownDuration(preAlert: 10, postAlert: 10)

Topics

Creating a countdown duration

init(preAlert: TimeInterval?, postAlert: TimeInterval?)

Creates an instance of a countdown duration.

var postAlert: TimeInterval?

The duration applied after the alarm has alerted at least once and moves

The duration applied before the alarm fires.

Relationships

Conforms To

  • Decodable
  • Encodable
  • Equatable
  • Sendable
  • SendableMetatype

See Also

Defining a countdown duration

var countdownDuration: Alarm.CountdownDuration?

The time left before an alert, in seconds.

Beta

var id: UUID

The unique identifier of the alarm.

enum State

An enum that lists all possible states of an alarm.

var state: Alarm.State

The current state of the alarm.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarm/schedule-swift.enum

  • AlarmKit
  • Alarm
  • Alarm.Schedule Beta

Enumeration

Alarm.Schedule

A list of all types of schedules that the framework supports.

enum Schedule

Topics

Setting an alarm schedule

struct Relative

An object that describes when an alarm alerts, relative to the device’s timezone.

case fixed(Date)

A one-shot alarm that fires at a specific time, not a time relative to the current time zone.

case relative(Alarm.Schedule.Relative)

An alarm that can repeat and fire at a time relative to the device’s current time zone.

Relationships

Conforms To

  • Decodable
  • Encodable
  • Equatable
  • Hashable
  • Sendable
  • SendableMetatype

See Also

Setting an alarm schedule

var schedule: Alarm.Schedule?

The schedule determines when the alarm alerts.

Beta

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarm/schedule-swift.enum/relative/repeats

  • AlarmKit
  • Alarm
  • Alarm
  • Alarm.Schedule
  • Alarm.Schedule.Relative
  • repeats Beta

Instance Property

repeats

The cadence at which the alarm repeats, if any.

var repeats: Alarm.Schedule.Relative.Recurrence

See Also

Describing an alarm

var time: Alarm.Schedule.Relative.Time

The hour and minute at which the alarm alerts, relative to the device’s current timezone.

Beta

enum Recurrence

Describes the cadence at which an alarm will repeat, if any.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarm/schedule-swift.enum/relative/recurrence/never

  • AlarmKit
  • Alarm
  • Alarm.Schedule
  • Alarm
  • Alarm.Schedule
  • Alarm.Schedule.Relative
  • Alarm.Schedule.Relative.Recurrence
  • Alarm.Schedule.Relative.Recurrence.never Beta

Case

Alarm.Schedule.Relative.Recurrence.never

An alarm that never repeats.

case never

See Also

Recurring alarms

case weekly([Locale.Weekday])

An alarm that repeats weekly, on the specified day.

Beta

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarm/schedule-swift.enum/relative/recurrence/weekly(_:)

#app-main)

  • AlarmKit
  • Alarm
  • Alarm.Schedule
  • Alarm
  • Alarm.Schedule
  • Alarm.Schedule.Relative
  • Alarm.Schedule.Relative.Recurrence
  • Alarm.Schedule.Relative.Recurrence.weekly(_:) Beta

Case

Alarm.Schedule.Relative.Recurrence.weekly(_:)

An alarm that repeats weekly, on the specified day.

case weekly([Locale.Weekday])

See Also

Recurring alarms

case never

An alarm that never repeats.

Beta

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmpresentation/alert-swift.struct/stopbutton

  • AlarmKit
  • AlarmPresentation
  • AlarmPresentation.Alert
  • stopButton Beta

Instance Property

stopButton

The appearance of the stop button.

var stopButton: AlarmButton

See Also

Creating a button

init(title: LocalizedStringResource, stopButton: AlarmButton, secondaryButton: AlarmButton?, secondaryButtonBehavior: AlarmPresentation.Alert.SecondaryButtonBehavior?)

Creates an alert for an alarm.

Beta

var title: LocalizedStringResource

The title of the alert.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmpresentation/alert-swift.struct/secondarybutton

  • AlarmKit
  • AlarmPresentation
  • AlarmPresentation.Alert
  • secondaryButton Beta

Instance Property

secondaryButton

The appearance of the secondary button.

var secondaryButton: AlarmButton?

Discussion

If you use nil, the secondary button is omitted.

See Also

Creating a second button

var secondaryButtonBehavior: AlarmPresentation.Alert.SecondaryButtonBehavior?

The behavior of the second button.

Beta

enum SecondaryButtonBehavior

Describes the behaviour of the second button.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmpresentation/alert-swift.struct/secondarybuttonbehavior-swift.property

  • AlarmKit
  • AlarmPresentation
  • AlarmPresentation.Alert
  • secondaryButtonBehavior Beta

Instance Property

secondaryButtonBehavior

The behavior of the second button.

var secondaryButtonBehavior: AlarmPresentation.Alert.SecondaryButtonBehavior?

Discussion

You can define the button to switch

Creating a second button

var secondaryButton: AlarmButton?

The appearance of the secondary button.

Beta

enum SecondaryButtonBehavior

Describes the behaviour of the second button.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmpresentation/alert-swift.struct/secondarybuttonbehavior-swift.enum/countdown

  • AlarmKit
  • AlarmPresentation
  • AlarmPresentation
  • AlarmPresentation.Alert
  • AlarmPresentation.Alert.SecondaryButtonBehavior
  • AlarmPresentation.Alert.SecondaryButtonBehavior.countdown Beta

Case

AlarmPresentation.Alert.SecondaryButtonBehavior.countdown

A case that indicates the secondary button is a countdown.

case countdown

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarm/countdownduration-swift.struct/postalert

  • AlarmKit
  • Alarm
  • Alarm.CountdownDuration
  • postAlert Beta

Instance Property

postAlert

The duration applied after the alarm has alerted at least once and moves

For example, this would be the snooze duration for an alarm. A timer with a repeat button could set this value to be the same as preAlert, or it could leave the value as nil. If the value is nil we will use the preAlert duration for post-alarm countdowns.

See Also

Creating a countdown duration

init(preAlert: TimeInterval?, postAlert: TimeInterval?)

Creates an instance of a countdown duration.

Beta

var preAlert: TimeInterval?

The duration applied before the alarm fires.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmpresentation/alert-swift.struct/secondarybuttonbehavior-swift.enum/custom

  • AlarmKit
  • AlarmPresentation
  • AlarmPresentation
  • AlarmPresentation.Alert
  • AlarmPresentation.Alert.SecondaryButtonBehavior
  • AlarmPresentation.Alert.SecondaryButtonBehavior.custom Beta

Case

AlarmPresentation.Alert.SecondaryButtonBehavior.custom

A case that indicates the secondary button has a custom behavior.

case custom

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmattributes/tintcolor

  • AlarmKit
  • AlarmAttributes
  • tintColor Beta

Instance Property

tintColor

The tint color applied to the templated UI.

var tintColor: Color

See Also

Creating an alarm attribute

init(presentation: AlarmPresentation, metadata: Metadata?, tintColor: Color)

Creates an instance of an alarm UI.

Beta

var presentation: AlarmPresentation

The content required for the various states of the UI.

var metadata: Metadata?

The additional data you can include in your attributes.

typealias ContentState

The type alias for the structure that describes the content of an alarm.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmattributes/metadata

  • AlarmKit
  • AlarmAttributes
  • metadata Beta

Instance Property

metadata

The additional data you can include in your attributes.

var metadata: Metadata?

Discussion

The additional data can be information that describes extra UI features you want to include in your countdown UI.

See Also

Creating an alarm attribute

init(presentation: AlarmPresentation, metadata: Metadata?, tintColor: Color)

Creates an instance of an alarm UI.

Beta

var tintColor: Color

The tint color applied to the templated UI.

var presentation: AlarmPresentation

The content required for the various states of the UI.

typealias ContentState

The type alias for the structure that describes the content of an alarm.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmmanager).


https://developer.apple.com/documentation/alarmkit/alarm/countdownduration-swift.struct)

The page you're looking for can't be found.

Search developer.apple.comSearch Icon


https://developer.apple.com/documentation/alarmkit/alarm/schedule-swift.enum)


https://developer.apple.com/documentation/alarmkit/alarm/schedule-swift.enum/relative/repeats)

The page you're looking for can't be found.

Search developer.apple.comSearch Icon


https://developer.apple.com/documentation/alarmkit/alarm/schedule-swift.enum/relative/recurrence/never).

.#app-main)

The page you're looking for can't be found.

Search developer.apple.comSearch Icon


https://developer.apple.com/documentation/alarmkit/alarm/schedule-swift.enum/relative/recurrence/weekly(_:))

)#app-main)

The page you're looking for can't be found.

Search developer.apple.comSearch Icon


https://developer.apple.com/documentation/alarmkit/alarmpresentation/alert-swift.struct),

,#app-main)

The page you're looking for can't be found.

Search developer.apple.comSearch Icon


https://developer.apple.com/documentation/alarmkit/alarmpresentation/countdown-swift.struct),

,#app-main)

The page you're looking for can't be found.

Search developer.apple.comSearch Icon


https://developer.apple.com/documentation/alarmkit/alarmpresentation/paused-swift.struct).

.#app-main)

The page you're looking for can't be found.

Search developer.apple.comSearch Icon


https://developer.apple.com/documentation/alarmkit/alarmpresentation/alert-swift.struct/stopbutton),

,#app-main)

The page you're looking for can't be found.

Search developer.apple.comSearch Icon


https://developer.apple.com/documentation/alarmkit/alarmpresentation/alert-swift.struct/secondarybutton)

The page you're looking for can't be found.

Search developer.apple.comSearch Icon


https://developer.apple.com/documentation/alarmkit/alarmpresentation/alert-swift.struct/secondarybuttonbehavior-swift.property).

.#app-main)

The page you're looking for can't be found.

Search developer.apple.comSearch Icon


https://developer.apple.com/documentation/alarmkit/alarmpresentation/alert-swift.struct/secondarybuttonbehavior-swift.enum/countdown),

,#app-main)

The page you're looking for can't be found.

Search developer.apple.comSearch Icon


https://developer.apple.com/documentation/alarmkit/alarm/countdownduration-swift.struct/postalert).

.#app-main)

The page you're looking for can't be found.

Search developer.apple.comSearch Icon


https://developer.apple.com/documentation/alarmkit/alarmpresentation/alert-swift.struct/secondarybuttonbehavior-swift.enum/custom),

,#app-main)

The page you're looking for can't be found.

Search developer.apple.comSearch Icon


https://developer.apple.com/documentation/alarmkit/alarmattributes/tintcolor),


https://developer.apple.com/documentation/alarmkit/alarmattributes/metadata).


https://developer.apple.com/documentation/alarmkit/alarmmanager/cancel(id:)),


https://developer.apple.com/documentation/alarmkit/alarmmanager/shared).


https://developer.apple.com/documentation/alarmkit/alarmbutton/init(text:textcolor:systemimagename:)

#app-main)

  • AlarmKit
  • AlarmButton
  • init(text:textColor:systemImageName:) Beta

Initializer

init(text:textColor:systemImageName:)

Creates an alarm button.

init( text: LocalizedStringResource, textColor: Color, systemImageName: String )

Parameters

text

The text for a label on the button.

textColor

The color for the text on the button.

systemImageName

The name of the icon you use on the button.

See Also

Creating a button

var systemImageName: String

Beta

var textColor: Color

var text: LocalizedStringResource

Text to show in a label on the button.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmbutton/systemimagename

  • AlarmKit
  • AlarmButton
  • systemImageName Beta

Instance Property

systemImageName

The name of the icon you use on the button.

var systemImageName: String

See Also

Creating a button

init(text: LocalizedStringResource, textColor: Color, systemImageName: String)

Creates an alarm button.

Beta

var textColor: Color

The color for the text on the button.

var text: LocalizedStringResource

Text to show in a label on the button.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmbutton/textcolor

  • AlarmKit
  • AlarmButton
  • textColor Beta

Instance Property

textColor

The color for the text on the button.

var textColor: Color

See Also

Creating a button

init(text: LocalizedStringResource, textColor: Color, systemImageName: String)

Creates an alarm button.

Beta

var systemImageName: String

The name of the icon you use on the button.

var text: LocalizedStringResource

Text to show in a label on the button.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmbutton/text

  • AlarmKit
  • AlarmButton
  • text Beta

Instance Property

text

Text to show in a label on the button.

var text: LocalizedStringResource

See Also

Creating a button

init(text: LocalizedStringResource, textColor: Color, systemImageName: String)

Creates an alarm button.

Beta

var systemImageName: String

The name of the icon you use on the button.

var textColor: Color

The color for the text on the button.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmbutton/encode(to:)

#app-main)

  • AlarmKit
  • AlarmButton
  • encode(to:) Beta

Instance Method

encode(to:)

Performs encoding to a given encoder.

func encode(to encoder: any Encoder) throws

Parameters

encoder

The encoder to write to.

See Also

Encoding and decoding

init(from: any Decoder) throws

Creates an alarm button from a decoder.

Beta

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmbutton/init(from:)

#app-main)

  • AlarmKit
  • AlarmButton
  • init(from:) Beta

Initializer

init(from:)

Creates an alarm button from a decoder.

init(from decoder: any Decoder) throws

Parameters

decoder

The decoder to read from.

See Also

Encoding and decoding

func encode(to: any Encoder) throws

Performs encoding to a given encoder.

Beta

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmbutton/init(text:textcolor:systemimagename:))

)#app-main)

The page you're looking for can't be found.

Search developer.apple.comSearch Icon


https://developer.apple.com/documentation/alarmkit/alarmbutton/systemimagename)


https://developer.apple.com/documentation/alarmkit/alarmbutton/textcolor)


https://developer.apple.com/documentation/alarmkit/alarmbutton/text)


https://developer.apple.com/documentation/alarmkit/alarmbutton/encode(to:))


https://developer.apple.com/documentation/alarmkit/alarmbutton/init(from:))


https://developer.apple.com/documentation/alarmkit/alarmattributes/init(presentation:metadata:tintcolor:)

#app-main)

  • AlarmKit
  • AlarmAttributes
  • init(presentation:metadata:tintColor:) Beta

Initializer

init(presentation:metadata:tintColor:)

Creates an instance of an alarm UI.

init( presentation: AlarmPresentation, metadata: Metadata? = nil, tintColor: Color )

Parameters

presentation

The content required for the various states of an alarm.

metadata

The additional data that you can include in your attributes.

tintColor

The tint color applied to the templated UI.

See Also

Creating an alarm attribute

var tintColor: Color

Beta

var presentation: AlarmPresentation

The content required for the various states of the UI.

var metadata: Metadata?

The additional data you can include in your attributes.

typealias ContentState

The type alias for the structure that describes the content of an alarm.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmattributes/presentation

  • AlarmKit
  • AlarmAttributes
  • presentation Beta

Instance Property

presentation

The content required for the various states of the UI.

var presentation: AlarmPresentation

See Also

Creating an alarm attribute

init(presentation: AlarmPresentation, metadata: Metadata?, tintColor: Color)

Creates an instance of an alarm UI.

Beta

var tintColor: Color

The tint color applied to the templated UI.

var metadata: Metadata?

The additional data you can include in your attributes.

typealias ContentState

The type alias for the structure that describes the content of an alarm.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmattributes/contentstate

  • AlarmKit
  • AlarmAttributes
  • AlarmAttributes.ContentState Beta

Type Alias

AlarmAttributes.ContentState

The type alias for the structure that describes the content of an alarm.

typealias ContentState = AlarmPresentationState

See Also

Creating an alarm attribute

init(presentation: AlarmPresentation, metadata: Metadata?, tintColor: Color)

Creates an instance of an alarm UI.

Beta

var tintColor: Color

The tint color applied to the templated UI.

var presentation: AlarmPresentation

The content required for the various states of the UI.

var metadata: Metadata?

The additional data you can include in your attributes.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmattributes/init(from:)

#app-main)

  • AlarmKit
  • AlarmAttributes
  • init(from:) Beta

Initializer

init(from:)

Creates an instance from the given decoder.

init(from decoder: any Decoder) throws

Parameters

decoder

The decoder to read from.

See Also

Decoding and encoding

func encode(to: any Encoder) throws

Performs encoding of the value using the given encoder.

Beta

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmattributes/encode(to:)

#app-main)

  • AlarmKit
  • AlarmAttributes
  • encode(to:) Beta

Instance Method

encode(to:)

Performs encoding of the value using the given encoder.

func encode(to encoder: any Encoder) throws

Parameters

encoder

The encoder to write to.

See Also

Decoding and encoding

init(from: any Decoder) throws

Creates an instance from the given decoder.

Beta

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmattributes/init(presentation:metadata:tintcolor:))

)#app-main)

The page you're looking for can't be found.

Search developer.apple.comSearch Icon


https://developer.apple.com/documentation/alarmkit/alarmattributes/tintcolor)


https://developer.apple.com/documentation/alarmkit/alarmattributes/presentation)


https://developer.apple.com/documentation/alarmkit/alarmattributes/metadata)


https://developer.apple.com/documentation/alarmkit/alarmattributes/contentstate)


https://developer.apple.com/documentation/alarmkit/alarmattributes/init(from:))


https://developer.apple.com/documentation/alarmkit/alarmattributes/encode(to:))


https://developer.apple.com/documentation/alarmkit/alarm/countdownduration-swift.property

  • AlarmKit
  • Alarm
  • countdownDuration Beta

Instance Property

countdownDuration

The time left before an alert, in seconds.

var countdownDuration: Alarm.CountdownDuration?

Discussion

When set to a non-nil value, the system shows the countdown in the Lock Screen for the specified duration. The UI will appear at a time equal to the next scheduled alert date minus the duration.

See Also

Defining a countdown duration

struct CountdownDuration

An object that defines the durations used in an alarm that has a countdown.

Beta

var id: UUID

The unique identifier of the alarm.

enum State

An enum that lists all possible states of an alarm.

var state: Alarm.State

The current state of the alarm.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarm/id

  • AlarmKit
  • Alarm
  • id Beta

Instance Property

id

The unique identifier of the alarm.

var id: UUID

See Also

Defining a countdown duration

struct CountdownDuration

An object that defines the durations used in an alarm that has a countdown.

Beta

var countdownDuration: Alarm.CountdownDuration?

The time left before an alert, in seconds.

enum State

An enum that lists all possible states of an alarm.

var state: Alarm.State

The current state of the alarm.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarm/state-swift.enum

  • AlarmKit
  • Alarm
  • Alarm.State Beta

Enumeration

Alarm.State

An enum that lists all possible states of an alarm.

enum State

Topics

Setting alarm states

case alerting

The alarm is currently firing.

case countdown

The alarm is counting down to its alert time.

case paused

A person paused the countdown.

case scheduled

The alarm is scheduled and ready to alert at the appropriate time.

Relationships

Conforms To

  • Copyable
  • Decodable
  • Encodable
  • Equatable
  • Hashable
  • Sendable
  • SendableMetatype

See Also

Defining a countdown duration

struct CountdownDuration

An object that defines the durations used in an alarm that has a countdown.

Beta

var countdownDuration: Alarm.CountdownDuration?

The time left before an alert, in seconds.

var id: UUID

The unique identifier of the alarm.

var state: Alarm.State

The current state of the alarm.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarm/state-swift.property

  • AlarmKit
  • Alarm
  • state Beta

Instance Property

state

The current state of the alarm.

var state: Alarm.State

Discussion

This is a snapshot of the state captured when the alarm was fetched from the daemon. It won’t update if the state changes on the daemon.

See Also

Defining a countdown duration

struct CountdownDuration

An object that defines the durations used in an alarm that has a countdown.

Beta

var countdownDuration: Alarm.CountdownDuration?

The time left before an alert, in seconds.

var id: UUID

The unique identifier of the alarm.

enum State

An enum that lists all possible states of an alarm.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarm/schedule-swift.property

  • AlarmKit
  • Alarm
  • schedule Beta

Instance Property

schedule

The schedule determines when the alarm alerts.

var schedule: Alarm.Schedule?

Discussion

If no schedule is supplied then the alarm will begin counting down immediately.

See Also

Setting an alarm schedule

enum Schedule

A list of all types of schedules that the framework supports.

Beta

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarm/countdownduration-swift.property)

The page you're looking for can't be found.

Search developer.apple.comSearch Icon


https://developer.apple.com/documentation/alarmkit/alarm/id)


https://developer.apple.com/documentation/alarmkit/alarm/state-swift.enum)


https://developer.apple.com/documentation/alarmkit/alarm/state-swift.property)


https://developer.apple.com/documentation/alarmkit/alarm/schedule-swift.property)


https://developer.apple.com/documentation/alarmkit/alarmpresentationstate/init(alarmid:mode:)

#app-main)

  • AlarmKit
  • AlarmPresentationState
  • init(alarmID:mode:) Beta

Initializer

init(alarmID:mode:)

Creates an instance of an alarm state.

init( alarmID: Alarm.ID, mode: AlarmPresentationState.Mode )

Parameters

alarmID

The unique ID of the alarm.

mode

The mode the alarm is in such as alerting or countdown.

See Also

Creating an alarm state

var alarmID: Alarm.ID

Beta

var mode: AlarmPresentationState.Mode

The specific state of the alarm, either alerting, countdown, or paused.

enum Mode

A list of all modes the alarm can be in: either alert, countdown, or paused.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmpresentationstate/alarmid

  • AlarmKit
  • AlarmPresentationState
  • alarmID Beta

Instance Property

alarmID

The unique ID of the alarm.

var alarmID: Alarm.ID

See Also

Creating an alarm state

init(alarmID: Alarm.ID, mode: AlarmPresentationState.Mode)

Creates an instance of an alarm state.

Beta

var mode: AlarmPresentationState.Mode

The specific state of the alarm, either alerting, countdown, or paused.

enum Mode

A list of all modes the alarm can be in: either alert, countdown, or paused.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmpresentationstate/mode-swift.property

  • AlarmKit
  • AlarmPresentationState
  • mode Beta

Instance Property

mode

The specific state of the alarm, either alerting, countdown, or paused.

var mode: AlarmPresentationState.Mode

Discussion

Use mode to determine which mode the alarm is in, so that a widget extension can produce the appropriate UI.

See Also

Creating an alarm state

init(alarmID: Alarm.ID, mode: AlarmPresentationState.Mode)

Creates an instance of an alarm state.

Beta

var alarmID: Alarm.ID

The unique ID of the alarm.

enum Mode

A list of all modes the alarm can be in: either alert, countdown, or paused.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmpresentationstate/mode-swift.enum

  • AlarmKit
  • AlarmPresentationState
  • AlarmPresentationState.Mode Beta

Enumeration

AlarmPresentationState.Mode

A list of all modes the alarm can be in: either alert, countdown, or paused.

enum Mode

Overview

This value is sent as part of AlarmPresentationState to the widget extension, so that it can produce the appropriate UI for the current state of the alarm.

Topics

Creating a countdown

struct Countdown

An object that specifies a countdown is in progress.

case countdown(AlarmPresentationState.Mode.Countdown)

A mode indicating the alarm timer is active.

Creating an alert

struct Alert

A value that indicates the current state of an alarm.

case alert(AlarmPresentationState.Mode.Alert)

A mode indicating an alarm emits an alert.

Pausing an alarm

struct Paused

An object that specifies the current state of the alarm is paused.

case paused(AlarmPresentationState.Mode.Paused)

A mode indicating the alarm isn’t active.

Relationships

Conforms To

  • Decodable
  • Encodable
  • Equatable
  • Hashable
  • Sendable
  • SendableMetatype

See Also

Creating an alarm state

init(alarmID: Alarm.ID, mode: AlarmPresentationState.Mode)

Creates an instance of an alarm state.

Beta

var alarmID: Alarm.ID

The unique ID of the alarm.

var mode: AlarmPresentationState.Mode

The specific state of the alarm, either alerting, countdown, or paused.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software


https://developer.apple.com/documentation/alarmkit/alarmpresentationstate/init(alarmid:mode:))

)#app-main)

The page you're looking for can't be found.

Search developer.apple.comSearch Icon


https://developer.apple.com/documentation/alarmkit/alarmpresentationstate/alarmid)


https://developer.apple.com/documentation/alarmkit/alarmpresentationstate/mode-swift.property)

The page you're looking for can't be found.

Search developer.apple.comSearch Icon


https://developer.apple.com/documentation/alarmkit/alarmpresentationstate/mode-swift.enum)

The page you're looking for can't be found.

Search developer.apple.comSearch Icon


API Access

GET /api/contexts/alarmkit JSON metadata + content
GET /api/contexts/alarmkit/raw Raw markdown