I need help getting nested data in Firebase.
Here is how my data is structured in Firebase:
- Meetups
- UniqueID
- address: "xxxx"
- date: "xxxx"
- creator: "xxxx"
- invitedFriends
- 1: "xxxx"
- 2: "xxxx"
- 3: "xxxx"
I am trying to figure out how to retrieve the invitedFriends data.
Currently I retrieve the data this way:
BASE_URL.child("meetups").observeEventType(.Value, withBlock: { snapshot in
self.meetups = []
if let snapshots = snapshot.children.allObjects as? [FIRDataSnapshot] {
for snap in snapshots {
if let postDictionary = snap.value as? Dictionary<String, AnyObject> {
let key = snap.key
let meetup = Meetup(key: key, dictionary: postDictionary)
self.meetups.insert(meetup, atIndex: 0)
}
}
This allows me to create an instance of my Meetup class from the address, date, and creator. However, I recently added the invitedFriends data to the structure and I am trying to figure out how to query it in this same process. Thank you for any suggestions!