I'm trying to access all the questions in the tree that starts from
var ref = FIRDatabase.database().reference().child("trivia")
and when I print the contents with the following function
func observeQuestion(completion: @escaping (Trivia) -> Void) {
ref.observe(.value, with: { snapshot in
if let dict = snapshot.value {
print("\(dict)")
}
})
}
I get the tree as follows
But I can't figure out how to access the Question
and print that out, it always comes out as nil
. I want to access all the questions value and store them in an array. How should I approach this?