0 votes
26 views
asked by (8.2k points)

Hi All

  iOS 10 Apple has deprecated UILocalNotification which means it is time to get familiar with a new notifications framework. Can any one give sample code for this

1 Answer

0 votes
answered by
Hi Try this below code

import UserNotifications

func scheduleLocal() {
    let center = UNUserNotificationCenter.current()
            let content = UNMutableNotificationContent()
            content.body = “Local Notification“
            content.sound = UNNotificationSound.default()
            let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 1,repeats: false)
            let request = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: trigger)
                center.add(request)
}

Categories

...