For some reason when i add the code if user.uid == uid {return}
it will return out of the function altogether and not add any users to the array even though i only want to filter out the current user from being added to the array?
func fireStoreFetchUsers(){
guard let uid = Auth.auth().currentUser?.uid else { return }
let db = Firestore.firestore()
db.collection("Users")
.getDocuments() { (querySnapshot, err) in
if let err = err {
print("Error getting documents: \(err)")
} else {
for document in querySnapshot!.documents {
let dictionary = document.data()
let user = User2(uid: "", distanceFrom: "any", dictionary: dictionary)
if user.uid == uid {return}
self.users.append(user)
self.collectionView?.reloadData()
}
}
}
}
returnmeans. It sounds like you want tocontinue.