Class

UNCalendarNotificationTrigger

A trigger condition that causes a notification to be delivered at a specific date and time.

Overview

Create a UNCalendarNotificationTrigger object when you want to schedule the delivery of a local notification at the specified date and time. You specify the temporal information using an NSDateComponents object, which lets you specify only the time values that matter to you. The system uses the provided information to determine the next date and time that matches the specified information.

Listing 1 creates a trigger that delivers its notification every morning at 8:30. The repeating behavior is achieved by specifying true for the repeats parameter when creating the trigger.

Listing 1

Creating a trigger that repeats at a specific time

var date = DateComponents()
date.hour = 8
date.minute = 30 
let trigger = UNCalendarNotificationTrigger(dateMatching: date, repeats: true)

Topics

Creating a Calendar Trigger

init(dateMatching: DateComponents, repeats: Bool)

Creates a calendar trigger from the specified date components.

Getting the Trigger Information

func nextTriggerDate() -> Date?

The next date at which the trigger conditions will be met.

var dateComponents: DateComponents

The date components used to construct this object.

Relationships

Conforms To

See Also

Triggers

class UNTimeIntervalNotificationTrigger

A trigger condition that causes a notification to be delivered after the specified amount of time elapses.

class UNLocationNotificationTrigger

A trigger condition that causes a notification to be delivered when the user's device enters or exits the specified geographic region.

class UNPushNotificationTrigger

A trigger condition that indicates the notification was sent from Apple Push Notification Service (APNs).

class UNNotificationTrigger

The common behavior for subclasses that trigger the delivery of a local or remote notification.