I am making an app using Swift and Firebase. I want to get an array list containing all of the numbers under a certain user id (images attached below). What I mean by this is I want to be able to call a function that returns an array list containing every integer (from low to high) placed as a child of the user id, but not containing their values (in this case "true"). I have already gotten a snapshot of the data (see code below), but I am unsure as to what to do now.
My Code:
func likeToLikeForAll() {
let uid = Auth.auth().currentUser?.uid
Database.database().reference().child("Liked Movies").child(uid!).observeSingleEvent(of: .value, with: { (snapshot) in
if let dictionary = snapshot.value as? [String: AnyObject] {
print()
print("SNAP:")
print(snapshot.value!)
print()
}
})
}
Create an array from the keys
let array = Array(dictionary.keys)
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments