I want to get the post for only the postkeys that are in the array. I have tried with the code below and some variations of it, but it doesn't work. Does anyone know how to do this?
func fetchData(){
DataService.ds.REF_POSTS.queryEqual(toValue: postKeys[IndexPath]).observeSingleEvent(of: .value, with: { (snapshot) in
if let snapshot = snapshot.children.allObjects as? [DataSnapshot]{
for snap in snapshot {
print("SNAP: \(snap)")
if let postDict = snap.value as? Dictionary<String, Any>{
let key = snap.key
let post = Post.init(postKey: key, postData: postDict)
self.posts.append(post)
print("USERPST: \(self.posts)")
}
}
}
self.posts.reverse()
self.tableView.reloadData()
})
}