Marcelo Marcelo - 2 months ago 36
Swift Question

Alarm presenting specific View Controller instead of notification for iOS 10

I want to create an alarm clock that when the time is fired, the notification provided to the user is a specific view controller, such as the alarm clock from Apple's Clock app.. Since 'UILocalNotification' was deprecated in iOS 10.0, what is the best way to approach it? Should I create it with UNNotificationRequest framework? Could anyone guide me of how should I do it? Thanks!

enter image description here

Answer

The alarm app is able to do this because it is a first-class iOS citizen. Third-party apps may not take over the lock screen (or home screen) like that.

The closest thing you could do is use the UserNotifications framework in iOS 10 to make it so that a custom View Controller is displayed when a user 3D-touches on the notification (or taps View on non-3D-Touch devices.)

This set of WWDC16 videos describes in detail what you can do with iOS 10 notifications.

Introduction to Notifications

Advanced Notifications

Comments