I have nested data that I'd like to display in a tableView.
My data is structured like so...
/users
/userid
name: "John"
age: 23
/likedPosts
0:post1
1:post2
For the tableview I'd like to display these posts (which have their own collection of data).
In order to do that I need to...
1) Get the count of the array and
2) Query the users likedPost array values to get the content of the post.
I'm currently using the getDocument function and can't figure it out.
for example...
func getUserLikedPosts() {
if let user = Auth.auth().currentUser {
let userFS = Firestore.firestore().collection("users").document(user.uid)
userFS.getDocument(completion: { (snapshot, error) in
print(snapshot?)
})
}
}
This doesn't even print out the nested array?