> On Jun 21, 2016, at 10:11 PM, Charlie Monroe <char...@charliemonroe.net> > wrote: > > Unfortunately, this is not as easy, because automatic bridging won't be > applied: > > let myString: String? = "Hello" > let anyValue: Any = myString > > myString as? AnyObject // _NSContiguousString > anyValue as? AnyObject // nil, since String is struct > > let array: [String]? = ["Hello"] > let anyArray: Any = array > anyArray as? AnyObject // nil > anyArray as? [AnyObject] // nil > array as? AnyObject // ["Hello"] > > And this goes for strings, arrays, dictionaries and possibly other types. > Which means that you need to handle manually all of the bridging to ObjC > types, which has really grown in Swift 3, taking into account all the > Foundation types that are now structs.
I'd call that a bug, not something requiring evolution discussion. We're trying to phase this behavior out of dynamic casts, though (see https://github.com/apple/swift-evolution/blob/master/proposals/0083-remove-bridging-from-dynamic-casts.md). -Joe _______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution