Created
July 9, 2014 10:12
-
-
Save hollance/7dfe95b4b9f9371d3b87 to your computer and use it in GitHub Desktop.
CGPoint and tuples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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