Mac Developer Library

Developer

EventKit Framework Reference EKAlarm Class Reference

Options
Deployment Target:

On This Page
Language:

EKAlarm

Inheritance


Conforms To


Import Statement


Swift

import EventKit

Objective-C

@import EventKit;

Availability


Available in OS X v10.8 and later.

An EKAlarm object represents an alarm in Event Kit. Use the alarmWithAbsoluteDate: and alarmWithRelativeOffset: class methods to create an alarm and use the properties to set information about an alarm. In OS X Mountain Lion, you can specify an action to trigger when the alarm fires via the emailAddress, soundName, or url property.

  • Creates and returns an alarm with an absolute date.

    Declaration

    Swift

    init!(absoluteDate date: NSDate!) -> EKAlarm

    Objective-C

    + (EKAlarm *)alarmWithAbsoluteDate:(NSDate *)date

    Parameters

    date

    The date for the alarm.

    Return Value

    The created alarm.

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in OS X v10.8 and later.

  • Creates and returns an alarm with a relative offset.

    Declaration

    Swift

    init!(relativeOffset offset: NSTimeInterval) -> EKAlarm

    Objective-C

    + (EKAlarm *)alarmWithRelativeOffset:(NSTimeInterval)offset

    Parameters

    offset

    The offset from the start of an event, at which the alarm fires.

    Return Value

    The created alarm.

    Discussion

    Negative offset values fire before the start of the event, while positive values fire after the start.

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in OS X v10.8 and later.

  • The absolute date for the alarm.

    Declaration

    Swift

    @NSCopying var absoluteDate: NSDate!

    Objective-C

    @property(nonatomic, copy) NSDate *absoluteDate

    Discussion

    If you set this property for a relative offset alarm, it loses the relative offset and becomes an absolute alarm.

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in OS X v10.8 and later.

  • The offset from the start of an event, at which the alarm fires.

    Declaration

    Swift

    var relativeOffset: NSTimeInterval

    Objective-C

    @property(nonatomic) NSTimeInterval relativeOffset

    Discussion

    If you set this value for an absolute alarm, it loses its absolute date and becomes a relative offset alarm.

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in OS X v10.8 and later.

  • The location to trigger an alarm.

    Declaration

    Swift

    @NSCopying var structuredLocation: EKStructuredLocation!

    Objective-C

    @property(nonatomic, copy) EKStructuredLocation *structuredLocation

    Discussion

    This property is used in conjunction with proximity to perform geofence-based triggering of reminders.

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in OS X v10.8 and later.

  • proximity proximity Property

    A value indicating how a location-based alarm is triggered.

    Declaration

    Swift

    var proximity: EKAlarmProximity

    Objective-C

    @property(nonatomic) EKAlarmProximity proximity

    Discussion

    Alarms can be set to trigger when entering or exiting a location specified by structuredLocation. By default, alarms are not affected by location.

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in OS X v10.8 and later.

    See Also

    EKAlarmProximity

These properties are only available on OS X 10.8 or later.

  • type type Property

    The type of action to trigger when the alarm fires. (read-only)

    Declaration

    Swift

    var type: EKAlarmType { get }

    Objective-C

    @property(nonatomic, readonly) EKAlarmType type

    Discussion

    To set the type of alarm, define one of emailAddress, soundName, or url.

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in OS X v10.8 and later.

    See Also

    EKAlarmType

  • The recipient of an email to send when the alarm triggers.

    Declaration

    Swift

    var emailAddress: String!

    Objective-C

    @property(nonatomic, copy) NSString *emailAddress

    Discussion

    Assigning this property a value will set the soundName and url properties to nil.

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in OS X v10.8 and later.

  • soundName soundName Property

    The name of the sound to play when the alarm triggers.

    Declaration

    Swift

    var soundName: String!

    Objective-C

    @property(nonatomic, copy) NSString *soundName

    Discussion

    The value of this property is the name of a system sound that can be used with the soundNamed: class method to create an NSSound object. Assigning this property a value will set the emailAddress and url properties to nil.

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in OS X v10.8 and later.

  • url url (OS X v10.9) Property

    The URL to open when the alarm triggers.

    Declaration

    Objective-C

    @property(nonatomic, copy) NSURL *url

    Discussion

    Assigning this property a value will set the emailAddress and soundName properties to nil.

    Import Statement

    Objective-C

    @import EventKit;

    Availability

    Available in OS X v10.8 and later.

    Deprecated in OS X v10.9.

Data Types

  • Possible values that can be read from the type property.

    Declaration

    Swift

    struct EKAlarmType { init(_ value: UInt32) var value: UInt32 }

    Objective-C

    typedef enum { EKAlarmTypeDisplay, EKAlarmTypeAudio, EKAlarmTypeProcedure, EKAlarmTypeEmail, } EKAlarmType;

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in OS X v10.8 and later.

  • A value indicating whether an alarm is triggered by entering or exiting a region.

    Declaration

    Swift

    typealias EKAlarmProximity = Int

    Objective-C

    typedef enum { EKAlarmProximityNone, EKAlarmProximityEnter, EKAlarmProximityLeave, } EKAlarmProximity;

    Constants

    • EKAlarmProximityNone

      EKAlarmProximityNone

      The alarm has no proximity trigger.

      Available in OS X v10.8 and later.

    • EKAlarmProximityEnter

      EKAlarmProximityEnter

      The alarm is set to fire when entering a region.

      Available in OS X v10.8 and later.

    • EKAlarmProximityLeave

      EKAlarmProximityLeave

      The alarm is set to fire when leaving a region.

      Available in OS X v10.8 and later.

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in OS X v10.8 and later.