Skip to content

Instantly share code, notes, and snippets.

@daehn
Created September 12, 2015 16:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daehn/713827981754b63e7cc8 to your computer and use it in GitHub Desktop.
Save daehn/713827981754b63e7cc8 to your computer and use it in GitHub Desktop.
extension SequenceType {
func first(@noescape predicate: Generator.Element -> Bool) -> Generator.Element? {
for element in self {
if predicate(element) {
return element
}
}
return nil
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment