Skip to content

Instantly share code, notes, and snippets.

@GxocT
Created July 17, 2018 11:22
Show Gist options
  • Save GxocT/1ec636a25d92b8ad0fcf267d30c736be to your computer and use it in GitHub Desktop.
Save GxocT/1ec636a25d92b8ad0fcf267d30c736be to your computer and use it in GitHub Desktop.
func didReceive(_ response: UNNotificationResponse, completionHandler completion: @escaping (UNNotificationContentExtensionResponseOption) -> Void) {
switch response.actionIdentifier {
case "like-action":
let actions = [
UNNotificationAction(identifier: "1-star", title: "★", options: []),
UNNotificationAction(identifier: "2-star", title: "★ ★", options: []),
UNNotificationAction(identifier: "3-star", title: "★ ★ ★", options: []),
]
extensionContext?.notificationActions = actions
case "open-app":
openApp()
default:
dismissNotification()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment