According to this answer on the question Value of type 'String' does not conform to expected dictionary value type 'AnyObject', importing Foundation should implicitly bridge a Swift String
struct to NSString
, so it can be used in [String : AnyObject]
dictionaries. But I'm not seeing that behavior in Xcode 8/Swift 3:
import Foundation
let dict: [String : AnyObject] = ["hello" : "world"] // Value of type 'String' does not conform to expected dictionary value type 'AnyObject'
Are Swift Strings no longer implicitly bridged to NSString
? Are my only options to cast my String
value as AnyObject
or NSString
, or use a [String : Any]
dictionary type instead?