CloudKit Notifications and Swift 3b6 Syntax Thing

So, I have had code like this for ages:


    func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
        if let remoteNotificationInfo = userInfo as? [String : NSObject] {
            let cloudKitNotification = CKNotification(fromRemoteNotificationDictionary: remoteNotificationInfo)
               //do stuff
        }
   }

This won't compile in Xcode 8b6 because it says that [AnyHashable : Any] is not converible to [String : NSObject]... but CKNotification(fromRemoteNotificationDictionary:) wants [String : NSObject].

What's the right way to make this work with the latest Swift changes?

Cheers.

From Twitter, a work-around:


as NSDictionary as! [String: AnyObject]
CloudKit Notifications and Swift 3b6 Syntax Thing
 
 
Q