0
我有五种观察方法,它们从Firebase获取五个不同的INT值。所有的脚本实际上都在工作。如果我打印快照,控制台会显示五个不同的值。在五种观察方法之外,我有一个连接到条形图的数组。我想取第一个值并将其附加到数组的[0]中,依此类推。 这是我的代码:Firebase观察并获取数组的值
let myArray = [1, 2, 3, 4, 5]
var exampleString = (label.text?.lowercased())!
ref2 = FIRDatabase.database().reference()
ref2.child("parole_chiave").child(exampleString).child(exampleString).child("valore1").observe(.value, with: { snapshot in
print(snapshot.value!)
})
ref2.child("parole_chiave").child(exampleString).child(exampleString).child("valore2").observe(.value, with: { snapshot in
print(snapshot.value!)
})
ref2.child("parole_chiave").child(exampleString).child(exampleString).child("valore3").observe(.value, with: { snapshot in
print(snapshot.value!)
})
ref2.child("parole_chiave").child(exampleString).child(exampleString).child("valore4").observe(.value, with: { snapshot in
print(snapshot.value!)
})
ref2.child("parole_chiave").child(exampleString).child(exampleString).child("valore5").observe(.value, with: { snapshot in
print(snapshot.value!)
})