I have already updated to Xcode 8 and now I need to convert my code from Swift 2 to Swift 3.
Before, when I want to convert NSDictionary
to Dictionary
, I just wrote the following:
let post_paramsValue = post_params as? Dictionary<String,AnyObject?>
where post_params
is NSDictionary
.
But now with Swift 3, I am receiving this error:
NSDictionary is not convertible to Dictionary
Why? What's changed?
Edit 1
I've also tried the following:
let post_paramsValue = post_params as Dictionary<String,Any>
But that gives this error:
Edit 2
I've also tried the following:
let post_paramsValue = post_params as Dictionary<String,Any>
Where I declare NSDictionary
instead of NSDictionary!
, but it doesn't work; I got this error:
Edit 3
I've also tried the following:
let post_paramsValue = post_params as Dictionary<String,Any>!
But I received this error: