İOS 10 Local Notification Classs
Create class variable
var notif:KNotification!
notif = KNotification.instance
notif.current.delegate = self
notif.content.title = "Title"
notif.content.subtitle = "Subtitle"
notif.content.body = "Hi!"
notif.content.sound = UNNotificationSound.default()
notif.content.categoryIdentifier = "actionTest"
Schedule notification
notif.schedule(at: 5, requestId: "test1") // TimeInterval
notif.schedule(at: sender.date, requestId: "test2") // Date
Add actions
notif.addActions(titles: ["remind"], ids: ["remind"], categoryId: "actionTest")
Extension VC
extension yourVC:UNUserNotificationCenterDelegate {
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
if response.actionIdentifier == "remind" {
print("action action !")
print(response.notification.request.identifier)
}
completionHandler()
}
}
Add Attachment image
notif.addAttechment(name: "profile.png")