This code gives warning "Expression implicitly coerced from 'String?' to Any."
let email : String?;
let password : String?;
let dict = ["email": email, "password": password] as [String: Any];
But this code does not.
let email : String?;
let password : String?;
let dict = ["email": email, "password": password] as [String: AnyObject];
Why? And how can I make that Any
does not bother me with warning about optionals like AnyObject
?
EDIT:
This code also does not gives away warning:
let email : String;
let password : String;
let dict = ["email": email, "password": password] as [String: Any];
But I need to be able to incorporate both object and optionality in this case. It seems the warning only appears if the variable type is both object and optional.