Last active
October 15, 2016 14:18
-
-
Save azimin/4d0fb55fbaa12e002642 to your computer and use it in GitHub Desktop.
UIApplicationShortcutItem creating 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
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