Skip to content

Instantly share code, notes, and snippets.

@FlexMonkey
Created January 13, 2016 13:52
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 FlexMonkey/3b500550fe51fa659d88 to your computer and use it in GitHub Desktop.
Save FlexMonkey/3b500550fe51fa659d88 to your computer and use it in GitHub Desktop.
distanceTo() - extension to CGPoint returns distance between two points
extension CGPoint
{
func distanceTo(point: CGPoint) -> CGFloat
{
return hypot(self.x - point.x, self.y - point.y)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment