如何将字典类型[Int:[Int [Int:String]]]转换为[String:[String:[String:String]]]

时间:2017-01-06 10:53:11

标签: dictionary swift3 type-conversion

我目前在Swift中有一个字典,它是一种[Int:[Int[Int:String]]]

我尝试使用

let myDict:[Int:[Int[Int:String]]] = //Values
let dictToStringDict = myDict as! [String:[String:[String:String]]]

唯一的问题是Xcode给了我错误[Int:[Int[Int:String]]] is not convertible to [String:[String:[String:String]]]

如何将[Int:[Int[Int:String]]]转换为[String:[String:[String:String]]]

1 个答案:

答案 0 :(得分:0)

请尝试做类似

的事情
    let myDict:[Int:[Int:[Int : String]]] = [Int:[Int:[Int : String]]]()
    let dictToStringDict = myDict as AnyObject
    let toanotjer = dictToStringDict as! [String:[String:[String:String]]]