Skip to content

Instantly share code, notes, and snippets.

@pgpt10
Created May 28, 2018 17:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pgpt10/abdfd0bfc39653387bb6d77854f3a76e to your computer and use it in GitHub Desktop.
Save pgpt10/abdfd0bfc39653387bb6d77854f3a76e to your computer and use it in GitHub Desktop.
//Actions
let remindLaterAction = UNNotificationAction(identifier: "remindLater", title: "Remind me later", options: UNNotificationActionOptions(rawValue: 0))
let acceptAction = UNNotificationAction(identifier: "accept", title: "Accept", options: .foreground)
let declineAction = UNNotificationAction(identifier: "decline", title: "Decline", options: .destructive)
let commentAction = UNTextInputNotificationAction(identifier: "comment", title: "Comment", options: .authenticationRequired, textInputButtonTitle: "Send", textInputPlaceholder: "Share your thoughts..")
//Category
let invitationCategory = UNNotificationCategory(identifier: "INVITATION", actions: [remindLaterAction, acceptAction, declineAction, commentAction], intentIdentifiers: [], options: UNNotificationCategoryOptions(rawValue: 0))
//Register the app’s notification types and the custom actions that they support.
center.setNotificationCategories([invitationCategory])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment