Skip to content

Instantly share code, notes, and snippets.

@janodev
Created August 16, 2016 12:55
Show Gist options
  • Save janodev/a5721c1787b261c4e4d4d95e906480f5 to your computer and use it in GitHub Desktop.
Save janodev/a5721c1787b261c4e4d4d95e906480f5 to your computer and use it in GitHub Desktop.
Handle the action
class NotificationViewController: UIViewController, UINotificationContentExtension
{
func didReceive(_ response: UNNotificationResponse,
completionHandler done: (UNNotificationContentExtensionResponseOption) -> Void)
{
server.postEventResponse(response.actionIdentifier)
{
if response.actionIdentifier == "accept"
{
eventResponse.text = "Going!"
eventResponse.textColor = UIColor.green()
}
else if response.actionIdentifier == "decline"
{
eventResponse.text = "Not going :("
eventResponse.textColor = UIColor.red()
}
done(.dismiss)
}
}
}
@anshuljain1208
Copy link

Hi,
I am trying to implement something like this in my app, I have a question regarding the line no.6, Where did you get/create the object server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment