Skip to content

Instantly share code, notes, and snippets.

@ivangodfather
Created July 3, 2015 10:00
Show Gist options
  • Select an option

  • Save ivangodfather/ce5bc2544d3739aaaa96 to your computer and use it in GitHub Desktop.

Select an option

Save ivangodfather/ce5bc2544d3739aaaa96 to your computer and use it in GitHub Desktop.
var fruits = ["apple", "banana"]
var names = ["ivan", "john", "maria"]
var mainArray = [fruits, names]
// i want to return true if theres a name/fruit that is "john"
func search() -> Bool {
for object in mainArray {
if (object.filter { $0 == "john" }).count > 0 {
return true
}
}
return false
}
search()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment