I have a custom object array of type LeaderboardUser(). This object contains a string variable of "uid", "email".
I am trying to make a statement to recognize if the uid given matches the uid of the LeaderBoard
if self.allFriends.contains() {
// Remove user
Database.database().reference().child("Users").child(Auth.auth().currentUser!.uid).child("Friends").child(self.uid).removeValue()
} else {
// Add user
let key = Database.database().reference().child("Users").childByAutoId().key
let friends = ["uid" : "\(self.uid)"] as [String : Any]
let totalList = ["\(key!)" : friends]
Database.database().reference().child("Users").child(Auth.auth().currentUser!.uid).child("Friends").updateChildValues(totalList)
}
Is there any way that I can search the UID parameter? I tried a contains() bool, but I don't know what and how how that works.
allFriendsis the array containing elements of typeLeaderboardUser?