I am using SwiftyJSON
to parse a JSON array
and can't figure out why I can't use the values when parsing the array to populate a Dictionary
.
var dictionary = [String: String]()
for (index: String, subJson: JSON) in json[myArray] {
let name = subJson["name"].string
let value = subJson["value"].string
gameOwned += [name: value]
}
I am receiving this error on this line:
gameOwned += [name: value]
Am I adding it to the empty dictionary wrong? I have already tested the values of name
and value
and they println with no problems.