Search code examples
iosswift3xcode83dtouch

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


Solution

  • 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)