Introducing ScheduledNotificationsViewController

TL;DR? Check out our new Swift package, it helps you debug local notifications with ease and elegance.

At my company we’ve had a few projects recently where we had to implement a sophisticated and sometimes quite complex local notifications system. It’s always tricky to get right, because there are always tons and tons of moving parts. It’s very nuanced, as one would expect.

Making sure that your code works as expected is not always easy. Say you’ve scheduled notifications for the next 40 days — now what? Should you wait 40 days to make sure that they get delivered as intended? I didn't think so.

That’s why recently I’ve created a simple debug screen that lets you see all of the pending local notifications in one place. All the data you could possibly need is there: next trigger date, identifiers, categories, and so on.

It proved extremely useful to be able to check if your notifications are scheduled properly right on your device or the simulator, without having to juggle breakpoints or searching the logs. It definitely helped to discover at least a few bugs that otherwise would’ve been extremely easy to miss.

The coolest feature I’ve added was simulating the notification delivery. So when we tap on any scheduled notification, its exact copy will be delivered immediately! It feels like magic:

This helps to see exactly how our notification will look once it’s delivered. And it doesn’t “replace” the scheduled notification too — the “real” one will still be delivered as planned!

This thing was so cool, that I ultimately decided to open source it

I quickly realized just how useful this screen was, and how many hours of development and debugging time it saved me. It is fairly self-contained and app-agnostic, so I knew I had to open source it and share it with all of you! I’m absolutely sure you’ll love this.

So, ScheduledNotificationsViewController is now available as a SwiftPM package on GitHub! Get it here:

It has no dependencies and a minimal API. It’s as “plug and play” as it gets. No configuration, no setup: just create a ScheduledNotificationsViewController() instance and you’re good to go.

Please try it out and let me know how it goes! Do you find it useful? Is there anything that you’re missing? Do you want it to have any other features, or to show more data? Use the comments section below, open a GitHub issue or drop me a line at oleg@dreyman.dev, I’ll be happy to help!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Oleg Dreyman

Oleg Dreyman

797 Followers

iOS development know-it-all. Talk to me about Swift, coffee, photography & motorsports.