Skip to content

Instantly share code, notes, and snippets.

@PattoMotto
Created July 9, 2018 11:23
Show Gist options
  • Save PattoMotto/50f752caf572f9cc6a5b9863847a910f to your computer and use it in GitHub Desktop.
Save PattoMotto/50f752caf572f9cc6a5b9863847a910f to your computer and use it in GitHub Desktop.
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