I have written this method to check if a shortcut already exists for the given id.
public static func shortcutExists(id: String, completion: @escaping ((Bool) -> Void)) {
var exists = false
INVoiceShortcutCenter.shared.getAllVoiceShortcuts { voiceShortcutsFromCenter, error in
if let voiceShortcutsFromCenter = voiceShortcutsFromCenter {
for voice in voiceShortcutsFromCenter {
if id == voice.shortcut.intent?.identifier { // What to do here?
exists = true
break
}
}
} else {
...
}
completion(exists)
}
}
I have a unique id for each intent entry. But I don't know how to save that ID as intent's identifier. The identifier seems rather readonly and seems to be autogenerated.
How can I achieve this please?