Created
July 9, 2018 11:23
-
-
Save PattoMotto/50f752caf572f9cc6a5b9863847a910f to your computer and use it in GitHub Desktop.
Shortcuts manager, full project https://github.com/neungnarakjung/CookBook-Siri-Shortcuts-Example
This file contains 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
import Intents | |
final class VoiceShortcutManager { | |
var voiceShortcuts: [INVoiceShortcut]? | |
init() { | |
updateShortcut() | |
} | |
public func updateShortcut(_ completion: (() -> Void)? = nil) { | |
INVoiceShortcutCenter.shared.getAllVoiceShortcuts {[weak self] (voiceShortcutsFromCenter, error) in | |
guard let voiceShortcuts = voiceShortcutsFromCenter else { | |
if let error = error as NSError? { | |
print(error) | |
} | |
return | |
} | |
self?.voiceShortcuts = voiceShortcuts | |
completion?() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment