Skip to content

Instantly share code, notes, and snippets.

@PattoMotto
Created July 9, 2018 11:51
Show Gist options
  • Save PattoMotto/07d177ae23fb112120390e21b841cc33 to your computer and use it in GitHub Desktop.
Save PattoMotto/07d177ae23fb112120390e21b841cc33 to your computer and use it in GitHub Desktop.
VoiceShortcutViewControllerDelegate, full project https://github.com/neungnarakjung/CookBook-Siri-Shortcuts-Example
import IntentsUI
extension ViewController: INUIAddVoiceShortcutViewControllerDelegate {
func addVoiceShortcutViewController(_ controller: INUIAddVoiceShortcutViewController,
didFinishWith voiceShortcut: INVoiceShortcut?,
error: Error?) {
if let error = error as NSError? {
print(error)
return
}
updateVoiceShortcuts()
dismiss(animated: true, completion: nil)
}
func addVoiceShortcutViewControllerDidCancel(_ controller: INUIAddVoiceShortcutViewController) {
dismiss(animated: true, completion: nil)
}
}
extension ViewController: INUIEditVoiceShortcutViewControllerDelegate {
func editVoiceShortcutViewController(_ controller: INUIEditVoiceShortcutViewController,
didUpdate voiceShortcut: INVoiceShortcut?,
error: Error?) {
if let error = error as NSError? {
print(error)
return
}
updateVoiceShortcuts()
dismiss(animated: true, completion: nil)
}
func editVoiceShortcutViewController(_ controller: INUIEditVoiceShortcutViewController,
didDeleteVoiceShortcutWithIdentifier deletedVoiceShortcutIdentifier: UUID) {
updateVoiceShortcuts()
dismiss(animated: true, completion: nil)
}
func editVoiceShortcutViewControllerDidCancel(_ controller: INUIEditVoiceShortcutViewController) {
dismiss(animated: true, completion: nil)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment