Skip to content

Instantly share code, notes, and snippets.

@hollance
Created July 9, 2014 10:12
Show Gist options
  • Select an option

  • Save hollance/7dfe95b4b9f9371d3b87 to your computer and use it in GitHub Desktop.

Select an option

Save hollance/7dfe95b4b9f9371d3b87 to your computer and use it in GitHub Desktop.
CGPoint and tuples
import Foundation
import CoreGraphics
@infix func * (left: CGPoint, right: (a: CGFloat, b: CGFloat)) -> CGPoint {
return CGPoint(x: left.x * right.a, y: left.y * right.b)
}
let pt1 = CGPointMake(100, 50)
let pt2 = pt1 * (2, 3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment