How to Make Interactive iOS 10 Notifications With User Notifications Framework


Up till now, we all have been using iOS push notifications to send alerts to app users. And honestly, it worked just fine. But, the new iOS 10 notifications have been taken to the next level. The new User Notifications framework allows us to embed custom view controller in iOS notifications. This will result into more powerful iOS 10 push notifications, that were possible possible to create before.

In this iOS app tutorial, we’ll cover the basic text iOS 10 notifications and making it interactive with like/dislike action button.

Let’s Get Started

Create a new project under file menu and select “Single View Application”.


In the next tab, customize your app details and click on finish.


Now, import the new notifications framework in ViewController.swift

// Swift

import UserNotifications

Get permission for notification and call it in viewDidLoad()

override func viewDidLoad() {


        // Do any additional setup after loading the view, typically from a nib.

        UNUserNotificationCenter.current().delegate = self






    //Authorization for Local Notification

    func authorizeNotification() {

        UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) { (success, error) in

            if let error = error {

                print("Error:- \(error)")

            } else if success == true {

                print("Permission Granted")





Once permission granted then create a click event scheduleNotification() for schedule notification.

@IBAction func scheduleNotification() {

                // Adding Action

        let likeAction = UNNotificationAction(identifier: "LikeID",

                                                title: "Like", options: [.foreground])

        let dislikeAction = UNNotificationAction(identifier: "DislikeID",

                                                title: "Dislike", options: [.foreground])


        let category = UNNotificationCategory(identifier: "app.likedislike.ios10",

                                              actions: [likeAction, dislikeAction],

                                              intentIdentifiers: [], options: [])


         // Create Notification Content

        let notificationContent = UNMutableNotificationContent()


        // Configure Notification Content

        notificationContent.title = "iOS 10 UserNotifications"

        notificationContent.subtitle = "Local Notifications"

        notificationContent.body = "The UserNotifications framework (UserNotifications.framework) supports the delivery and handling of local and remote notifications."

        notificationContent.categoryIdentifier = "app.likedislike.ios10"


        // Add Trigger

        let notificationTrigger = UNTimeIntervalNotificationTrigger(timeInterval: 10.0, repeats: false)

        // Create Notification Request

        let request = UNNotificationRequest(identifier: "app.likedislike.ios10",

                                            content: notificationContent, trigger: notificationTrigger)

        UNUserNotificationCenter.current().add(request, withCompletionHandler: { (error) in

            if let error = error {

                print("Error \(error)")

                // Something went wrong




And done!

By implementing this framework, you can now make interactive notifications in your iOS app. And this was a simple demo, but it is possible to make notifications even more interactional by embedding images or certain actions into the iOS 10 notifications. And if you need technical assistance, you can hire Swift developer from us to upgrade UI/UX of your mobile application.

Grab a free copy of User Notifications Framework Demo from Github.

You may also like,

This page was last edited on April 24th, 2020, at 2:43.


Want To Develop Interactive iOS App in Swift? Contact Us Now

Get your free consultation now

Leave a Reply

Your email address will not be published. Required fields are marked *

Get Your Free Quote