Menu

Building a Unified Push Notification Handler with Deep Linking in iOS
📰

Building a Unified Push Notification Handler with Deep Linking in iOS

DEV Community: firebase·Raaju Pahlowan·11 days ago
#jJxPP6XG
Long article (1432 words) — no AI summary yet.
Reading 0:00
15s threshold

Push notifications start out simple: show a banner, open the app. Then the product team adds a new notification type, then another, and soon you have twenty of them, each expected to open a different screen. If every type is handled by its own if branch inside the app delegate, the code becomes impossible to maintain.

In this article I'll show the structure I use for FCM and APNs notifications in a UIKit app: one entry point for every notification, typed payloads, local persistence, and a deep-link router that works even when the app was killed.

1. Set up one entry point

All notification events should flow through a single object. Make it the UNUserNotificationCenter delegate, and set it before the app finishes launching, otherwise you can miss a tap that cold-starts the app.

final class NotificationCoordinator : NSObject , UNUserNotificationCenterDelegate { static let shared = NotificationCoordinator ( ) private let router = DeepLinkRouter .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.