Reputation: 2327
In my example I saved complex data on Firebase and I want get it back.
When I am using this code I can get any values stoared in hashmap.
for rest in snapshot.children.allObjects as! [DataSnapshot] {
guard let restDict = rest.value as? [String: Any] else { continue }
let title = restDict["title"] as? String
let genre = restDict["genre"] as? NSDictionary
let singer = restDict["singer"] as? NSArray
print(genre?["title"])
}
in my database I also I have Singer as array (id, name, age).
How could I return this values as well?
Upvotes: 0
Views: 474
Reputation: 175
I do not believe firebase can store array types, however Firebase does explain how to store a list of values in its documentation: https://firebase.googleblog.com/2014/04/best-practices-arrays-in-firebase.html Hope this was helpful :)
Upvotes: 1