2
swiftyJSON对于解析Firebase看起来很不错。什么愿与落得为2点的可能性:Firebase和swiftyJSON解析
的imageName
一个单独的ID,并为所有的ID的imageName
的List。 JSON Struture:
ref.observe(FIRDataEventType.value) {
(snapshot: FIRDataSnapshot!) in
let json = JSON(snapshot.value)
// print("JSON: \(json)")
// PRINT IMAGENAME - NOT WORKING
if let imageName = json[12345][0]["imageName"].string {
print("imageName: \(imageName)")
}
// // PRINT IMAGENAME - NOT WORKING
let theKeys = json.dictionary!.keys
for key in theKeys {
let imageName = json[0][0]["imageName"]
print("imageName: \(imageName)")
}
}
我的最终结果是具有IMAGEURL中的CollectionView显示落得:检索JSON很好,但不显示imageName
值
代码。它似乎很接近,只是没有得到正确的swiftyJSON格式。谢谢。