Skip to content

Instantly share code, notes, and snippets.

@MaatheusGois
Created July 4, 2019 10:52
Show Gist options
  • Select an option

  • Save MaatheusGois/87f48d883e62bb599e8c068b9d69a060 to your computer and use it in GitHub Desktop.

Select an option

Save MaatheusGois/87f48d883e62bb599e8c068b9d69a060 to your computer and use it in GitHub Desktop.
//Quando a notificacao é respondida
func userNotificationCenter(_ center: UNUserNotificationCenter,
didReceive response: UNNotificationResponse,
withCompletionHandler completionHandler:
@escaping () -> Void) {
//--------------------------Linhas Adicionadas----------------------------
//Chamando identificador de ações
let identificador = response.actionIdentifier
//Pegando a resposta da notificação pela resposta da ação
if identificador == "Soneca"{
print("Deixa eu dormir mais um pouquinho!")
}
else if identificador == "Desligar" {
print("Ahhh, vou chegar atrasado mesmo!")
}
//-------------------------------------------------------------------------
//Não há retorno
completionHandler()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment