我有一个字典,该值包含字符串数组,如下所示
arr = ["key":"["a","b","c","d","e","f","g"]"]
我希望新数组像
let array = ["a","b","c","d","e","f","g"]
如何解析
答案 0 :(得分:1)
您可以通过几种不同的方式访问字典项,最简单的方法是:
let array = arr["key"]
您可能需要有条件地打开它
if let array = arr["key"] as? [String] {
// rest of code with array
}