I am trying to retrieve a dictionary from Firebase and extract each value from the dictionary and append it to an empty array, but my code doesn't work. I haven't even added the code for appending it to an array and when I run it, "error" is printed in the console.
This is what it looks like inside Firebase
And this is what my code looks like:
    func convertAllMosaicsToArray() {
    // retrieve and convert here
    Database.database().reference().child("mosiacTitles").observe(.value, with: { (snapshot) in
        if let dictionary = snapshot.value as? [Int : AnyObject] {
            print(dictionary)
        } else {
            print("error")
        }
    })
}
 
    