Swift dictionary declaration swift dictionary

Why is it a compilation error if I write:

let d = [String: AnyObject!]() // error: Operand postfix "!" should have an optional type

      

but not an error if i write:

let d = Dictionary<String, AnyObject!>() // ok

      

+3


source to share





All Articles