Created
July 4, 2019 10:52
-
-
Save MaatheusGois/87f48d883e62bb599e8c068b9d69a060 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //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