Class

UNTimeIntervalNotificationTrigger

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

Declaration

class UNTimeIntervalNotificationTrigger : UNNotificationTrigger

Overview

Create a UNTimeIntervalNotificationTrigger object when you want to schedule the delivery of a local notification after the specified number of seconds elapse. You use this type of trigger to implement timers.

Listing 1 creates a trigger that delivers its notification one time after thirty minutes have elapsed.

Listing 1

Creating a trigger that fires in 30 minutes

// Fire in 30 minutes (60 seconds times 30)
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: (30*60), repeats: false)

Topics

Creating a Time Interval Trigger

init(timeInterval: TimeInterval, repeats: Bool)

Creates a time interval trigger from the specified time value.

Getting the Trigger Information

func nextTriggerDate() -> Date?

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

var timeInterval: TimeInterval

The time interval used to create the trigger.

Relationships

Conforms To

See Also

Triggers

class UNCalendarNotificationTrigger

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

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.

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