I have this method which reads data from Firebase. However, when I want it to return a dictionary so I can use what I got from the Firebase, I get this problem:
"Unexpected non-void return value in void function"
which I don't understand because I do returning a dictionary (player
)
and I set the function to return a dictionary.
this is the function:
func ReadTeamPlayers(teamName name: String) -> [String:Any]{
ref.child(name).observeSingleEvent(of: .value) { (snapshot) in
let player = snapshot.value as? [String:Any]
return player
}
}