How can I allocate an array of AnyObject arrays into an array of String arrays ?
I tried the following code:
let v1:[[AnyObject]] = [["hello"]] // v1 type is [[AnyObject]] let v2 = v1 as! [[String]] // compile error!
but this code will not compile with an error:
'String' is not identical to "AnyObject"
if I'm just trying to convert an AnyObject array to a String array, it works fine:
let v1:[AnyObject] = ["hello"] // v1 type is [AnyObject] let v2 = v1 as! [String] // v2 type is [String] as expected
source share