Tom Coomer Tom Coomer - 1 month ago 28
iOS Question

3D Touch Shortcuts Stopped Working - Xcode 8

Since updating my Xcode Project to Swift 3 in Xcode 8 my 3D Touch shortcuts no longer work where they previously did. Do I need to change something in my code to get these working again?

Thank you

Answer

Updating to Xcode 8 beta 8 fixed this issue.

Edit 1:

Changing the line:

func application(_ application: UIApplication, performActionFor shortcutItem: UIApplicationShortcutItem, completionHandler: (Bool) -> Void) {
    let handledShortCutItem = handleShortCutItem(shortcutItem)

    completionHandler(handledShortCutItem)
}

to:

func application(_ application: UIApplication, performActionFor shortcutItem: UIApplicationShortcutItem, completionHandler: @escaping (Bool) -> Void) {
    let handledShortCutItem = handleShortCutItem(shortcutItem)

    completionHandler(handledShortCutItem)
}

(Added the @escaping)

Comments