@available(iOS 12.0, *)
extension YourViewController: INUIAddVoiceShortcutButtonDelegate {
func present(_ addVoiceShortcutViewController: INUIAddVoiceShortcutViewController, for addVoiceShortcutButton: INUIAddVoiceShortcutButton) {
// Tells the view controller to present as a formsheet that is animated (completion nil) and sets the delegate
addVoiceShortcutViewController.delegate = self
addVoiceShortcutViewController.modalPresentationStyle = .formSheet
present(addVoiceShortcutViewController, animated: true, completion: nil)
}
func present(_ editVoiceShortcutVC: INUIEditVoiceShortcutViewController, for addVoiceShortcutButton: INUIAddVoiceShortcutButton) {
// Tells the view controller to present as a formsheet that is animated (completion nil) and sets the delegate
editVoiceShortcutVC.delegate = self
editVoiceShortcutVC.modalPresentationStyle = .formSheet
present(editVoiceShortcutVC, animated: true, completion: nil)
}
}
@available(iOS 12.0, *)
extension YourViewController: INUIAddVoiceShortcutViewControllerDelegate {
func addVoiceShortcutViewController(_ controller: INUIAddVoiceShortcutViewController, didFinishWith voiceShortcut: INVoiceShortcut?, error: Error?) {
// To ensure that the view controller dismisses upon completion of the siri shortcut set up
controller.dismiss(animated: true, completion: nil)
}
func addVoiceShortcutViewControllerDidCancel(_ controller: INUIAddVoiceShortcutViewController) {
// To ensure that the view controller dismisses upon completion of the siri shortcut set up
controller.dismiss(animated: true, completion: nil)
}
}
@available(iOS 12.0, *)
extension YourViewController: INUIEditVoiceShortcutViewControllerDelegate {
func editVoiceShortcutViewController(_ controller: INUIEditVoiceShortcutViewController, didUpdate voiceShortcut: INVoiceShortcut?, error: Error?) {
// To ensure that the view controller dismisses upon completion of the siri shortcut set up
controller.dismiss(animated: true, completion: nil)
}
func editVoiceShortcutViewController(_ controller: INUIEditVoiceShortcutViewController, didDeleteVoiceShortcutWithIdentifier deletedVoiceShortcutIdentifier: UUID) {
// To ensure that the view controller dismisses upon completion of the siri shortcut set up
controller.dismiss(animated: true, completion: nil)
}
func editVoiceShortcutViewControllerDidCancel(_ controller: INUIEditVoiceShortcutViewController) {
// To ensure that the view controller dismisses upon completion of the siri shortcut set up
controller.dismiss(animated: true, completion: nil)
}
}