I am trying to remove a dictionary element in firebase
I want to remove the object :-
D8QmnOSH6vRYiMujKNXngzhdn992: "True"
at PendingFriendRequests/RhiZYyMF7STn1vyA27HjnJRsLYb2
so far i have come up with this :-
FIRControllerClass.ref.child("PendingFriendRequests").child(FIRAuth.auth()!.currentUser!.uid).observeSingleEventOfType(.Value, withBlock: {(Snapshot) in
let dict = Snapshot.value! as! NSMutableDictionary
for each in dict {
print(each)
print(acceptedFriend)
if each.key as! String == acceptedFriend{
print(each.key)
dict.removeObjectForKey(each.key)
print(dict)
}
FIRControllerClass.ref.child("PendingFriendRequests").child(acceptedFriend).setValue(dict)
}
})