Skip to content

Instantly share code, notes, and snippets.

@olbrichj
Created June 6, 2018 14:37
Show Gist options
  • Save olbrichj/447d4889269bbd852c425ad43204ccb2 to your computer and use it in GitHub Desktop.
Save olbrichj/447d4889269bbd852c425ad43204ccb2 to your computer and use it in GitHub Desktop.
if let shortcut = voiceShortcutDataManager?.voiceShortcut(for: order) {
let editVoiceShortcutViewController = INUIEditVoiceShortcutViewController(voiceShortcut: shortcut)
editVoiceShortcutViewController.delegate = self
present(editVoiceShortcutViewController, animated: true, completion: nil)
}
else {
if let shortcut = INShortcut(intent: order.intent) {
let addVoiceShortcutVC = INUIAddVoiceShortcutViewController(shortcut: shortcut)
addVoiceShortcutVC.delegate = self
present(addVoiceShortcutVC, animated: true, completion: nil)
}
}
extension ViewController: INUIAddVoiceShortcutViewControllerDelegate {
func addVoiceShortcutViewController(_ controller: INUIAddVoiceShortcutViewController, didFinishWith voiceShortcut: INVoiceShortcut?, error: Error?) {
}
func addVoiceShortcutViewControllerDidCancel(_ controller: INUIAddVoiceShortcutViewController) {
}
}
extension ViewController: INUIEditVoiceShortcutViewControllerDelegate {
func editVoiceShortcutViewController(_ controller: INUIEditVoiceShortcutViewController, didUpdate voiceShortcut: INVoiceShortcut?, error: Error?) {
}
func editVoiceShortcutViewController(_ controller: INUIEditVoiceShortcutViewController, didDeleteVoiceShortcutWithIdentifier deletedVoiceShortcutIdentifier: UUID) {
}
func editVoiceShortcutViewControllerDidCancel(_ controller: INUIEditVoiceShortcutViewController) {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment