Skip to content

Instantly share code, notes, and snippets.

@brunomunizaf
Last active June 7, 2019 01:37
Show Gist options
  • Save brunomunizaf/3d18e7c38b1933e24ae88affbb965d0d to your computer and use it in GitHub Desktop.
Save brunomunizaf/3d18e7c38b1933e24ae88affbb965d0d to your computer and use it in GitHub Desktop.
Rich push categories
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
UNUserNotificationCenter
.current()
.requestAuthorization(options: [.alert, .sound, .badge]) { _, _ in }
let openAction = UNNotificationAction(identifier: "open.action",
title: "Open door",
options: [])
let incomingCallCategory = UNNotificationCategory(identifier: "doorCategory",
actions: [openAction],
intentIdentifiers: [],
options: [])
UNUserNotificationCenter.current().setNotificationCategories([incomingCallCategory])
UNUserNotificationCenter.current().delegate = self
return true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment