Skip to content

Instantly share code, notes, and snippets.

@azimin
Last active October 15, 2016 14:18
Show Gist options
  • Save azimin/4d0fb55fbaa12e002642 to your computer and use it in GitHub Desktop.
Save azimin/4d0fb55fbaa12e002642 to your computer and use it in GitHub Desktop.
UIApplicationShortcutItem creating example
let shortcutExample = UIMutableApplicationShortcutItem(type: "my_app_basic_shortcut", localizedTitle: "Name")
shortcutExample.type = "my_app_basic_shortcut" // identify for your shortcut item (MUST EXIST)
shortcutExample.localizedTitle = "Name" // name of shortcut (MUST EXIST)
shortcutExample.localizedSubtitle = "Info about action" // subtitle of shortcut
shortcutExample.icon = UIApplicationShortcutIcon(type: .update) // inco of shortcut, will be discribed later
shortcutExample.userInfo = ["NoteItem": note as NSSecureCoding] // additional info, must be [String : NSSecureCoding]
// Update the application providing the initial 'dynamic' shortcut items.
application.shortcutItems = [shortcutExample]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment