I am currently struggling with accessing other data stored in a path, more specific the data from a sub-folder. My setup looks like this:
userID{
username:Andreas,
gender:Male,
age:18,
footballTeams{
Team1{
name:My team 1
matchesPlayed:3
}
}
}
So I am currently running this code to grab both username, gender and age:
ref.child("Users").observeEventType(.ChildAdded, withBlock: { (snapshot1:FIRDataSnapshot) in
//code goes here..
var username = String(snapshot1.value!["username"] as! String)
var gender = String(snapshot1.value!["gender"] as! String)
var age = Int(snapshot1.value!["age"] as! Int)
})
However, I want to grab all the team names stored in the footballTeams path, ordered like 'Team1, Team2, Team3' etc. So I stumbled upon "snapshot1.childSnapshotForPath("footballTeams/Team1").value!["name"]". However, this would have worked, as long as I knew the exact name of each team name-path, but this is stored as auto ID. Any ideas on how I would approach this?
Thanks in advance.