Skip to content

Instantly share code, notes, and snippets.

@skyebook
Last active February 22, 2016 16:06
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 skyebook/d3da22e34226d10cf480 to your computer and use it in GitHub Desktop.
Save skyebook/d3da22e34226d10cf480 to your computer and use it in GitHub Desktop.
Javascript has the really nice 'every', while we do this in swift. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every
// Is every point in this rectangle? This would be easy in JS.
let containsAllPoints = points.reduce(true) { return !$0 ? $0 : CGRectContainsPoint(rect, $1)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment