I'm trying to filter a list of users from a Firebase query so that I only get users that are NOT listed in one of two arrays. The code I'm using doesn't work:
let users = snapshot.childSnapshots.map {
User(snapshot: $0)
}.filter{
guardiansArray.contains($0.key) == false || dependentsArray.contains($0.key) == false
}
If I remove the ==false code, I get the opposite effect of what I want: I get a list of users that ARE in either of the two arrays. How can I get the reverse effect?
Thanks!
It looks like you want to use && instead of ||.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With