I was looking at the UIKit
framework reference and came across UIApplicationShortcutItem
. It is for 3D Touch.
It contains this code sample:
let existingShortcutItems = UIApplication.sharedApplication().shortcutItems ?? []
let anExistingShortcutItem = existingShortcutItems[anIndex]
var updatedShortcutItems = existingShortcutItems
let aMutableShortcutItem = anExistingShortcutItem.mutableCopy() as! UIMutableApplicationShortcutItem
aMutableShortcutItem.localizedTitle = “New Title"
updatedShortcutItems[anIndex] = aMutableShortcutItem
UIApplication.sharedApplication().shortcutItems = updatedShortcutItemsode here
If I am correct you put this in the app delegate?
And how does this work? Is the localizedTitle
method called to check the title of the action selected, and then call the action that has that title? Where are the actions held?