Logo for tanaschita.com

Scheduling notifications with time, calendar, and location triggers in iOS

Learn how to schedule local notifications using different trigger types with the UserNotifications framework.

12 May 2025 · 4 min read

The UserNotifications framework provides several flexible ways to schedule local notifications, depending on when and how we want them to be delivered.

In this guide, we'll walk through the three main types of triggers available for local notifications:

  • Time interval triggers – fire after a set number of seconds
  • Calendar triggers – fire at a specific date and time
  • Location triggers – fire when the user enters or exits a geographic region

Let's jump in.

Sponsorship logo
Architecture & Design Patterns for iOS
This book is a practical guide to essential architectural principles and design patterns for iOS development. It covers strategies for building maintainable apps with Swift and SwiftUI, including dependency injection, navigation, common patterns, and modularization.
LEARN MORE

Time interval trigger

A time interval trigger is the simplest option. It fires after a fixed amount of time has passed, making it perfect for short-term reminders or countdowns. For example, to trigger a notification 10 minutes from now, we would use:

import UserNotifications
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 10 * 60, repeats: false)

Calendar trigger

A calendar trigger allows us to schedule notifications based on specific dates and times or repeating intervals. This is ideal for recurring reminders, like daily health checks or weekly meeting reminders. For example, we can trigger a notification every morning at 7:30 with the following code:

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

This trigger provides a lot of flexibility, as we can match on any combination of date components, like weekday, month, or year, to precisely control when notifications are delivered.

Location trigger

A location trigger is a more context-aware option that fires when a user enters or exits a specified geographic region. For example, we can trigger a notification when a user exits a 20 km radius around Leipzig's city center:

import CoreLocation
let center = CLLocationCoordinate2D(latitude: 51.3396955, longitude: 12.3730747)
let region = CLCircularRegion(center: center, radius: 20 * 1000, identifier: "leipzig")
region.notifyOnEntry = false
region.notifyOnExit = true
let trigger = UNLocationNotificationTrigger(region: region, repeats: false)

With the notifyOnEntry and notifyOnExit properties, we can control whether the app should deliver notifications when the user enters, exits, or both. Keep in mind that location triggers require location permissions and can be affected by power-saving modes.

Sponsorship logo
Preparing for a technical iOS job interview
Preparing for a technical iOS Job Interview with over 300 questions & answers. Covering Swift & Objective-C, SwiftUI & UIKit, Combine, HTTP Networking, iOS File System, Core Data, Concurrency with async/await, Security, Automated Testing, Dependency Management, AI & Machine Learning and more.
LEARN MORE
Sponsorship logo
Architecture & Design Patterns for iOS
This book is a practical guide to essential architectural principles and design patterns for iOS development. It covers strategies for building maintainable apps with Swift and SwiftUI, including dependency injection, navigation, common patterns, and modularization.
LEARN MORE
Sponsorship logo
Become a sponsor of tanaschita.com
By publishing an article on different iOS topics every week, tanaschita.com is constantly growing in the developer community and may provide a great audience for you as a sponsor.
CLICK TO LEARN MORE

Newsletter

Image of a reading marmot
Subscribe

Like to support my work?

Say hi

Related tags

Articles with related topics

notifications

swiftui

swift

ios

Registering for push notifications in SwiftUI

Learn how to request notification permissions and register for remote notifications in a SwiftUI app.

01 Jun 2026 · 7 min read

Latest articles and tips

© 2026 tanaschita.com

Privacy policy

Impressum