Reputation: 817
I'm trying to the get a list data from the Firebase Database then convert as a array. I looked at many examples online but never managed to work (as far as I know) the code below is the closet I could get with 1 error.
ref.child("").observe(.childAdded, with: { (snapshot) -> Void in
var newItems = [FDataSnapshot]() //Error: Use of unresolved identifier 'FDataSnapshot'
for item in snapshot.children {
newItems.append(item as! FDataSnapshot)
}
})
I just cant find a answer since those past 2 days.
Thanks in advance for helping!
Upvotes: 2
Views: 2616
Reputation: 9945
Try this:-
ref.child("").observe(.childAdded, with: { (snapshot) in
var newItems = [FIRDataSnapshot]()
for item in snapshot.children {
newItems.append(item as! FIRDataSnapshot)
}
})
Upvotes: 7