Created
June 3, 2017 10:53
-
-
Save Czajnikowski/3013639e7acdf1360969fca753a41b76 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let contacts: [Contact] = … | |
let results = contacts.filter { contact in | |
var addressesMatchingQuery = [Address]() | |
for address in contact.addresses { | |
if address.city == searchQuery { | |
addressesMatchingQuery.append(address) | |
} | |
} | |
return addressesMatchingQuery.count > 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment