title: How to get userinfo from NSNotification in swift 3
body: <p>I got this error in swift3:</p>
  
  <pre><code>Cannot convert value of type [AnyHashable : Any] to type NSDictionary in coercion.
  </code></pre>
  
  <p>My Code is:</p>
  
  <pre><code>  func downloadProgress(notification:NSNotification){
  
      if let userInfo = notification.userInfo as NSDictionary
      {
           print(userInfo) // [AnyHashable("progressPercentage"): 0.82530790852915281]
  
        if let progressValue = userInfo["progressPercentage"] as? Float {
          if progressValue &gt; 0.01{
  
          }
        }
      }
    }
  </code></pre>
  
  <p>The actual userInfo value is <code>["progressPercentage": 0.82530790852915281]</code> but its printed as <code>[AnyHashable("progressPercentage"): 0.82530790852915281]</code> and not satisfying the <code>if</code> condition.</p>
  
  <p>Edit:</p>
  
  <p>No luck for <code>notification.userInfo as? [AnyHashable: Any]</code>, But now works for <code>notification.userInfo as? [String: AnyObject]</code> and <code>notification.userInfo as? [String: Any]</code></p>
  
  <p><a href="https://i.stack.imgur.com/Qtx35.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Qtx35.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/OEeMi.png" rel="noreferrer"><img src="https://i.stack.imgur.com/OEeMi.png" alt="enter image description here"></a></p>