Thought it'd be convenient to use tuples to set CGPoint properties, but I can't seem to figure out what swift wants me to do:
infix operator = {associativity right precedence 150} // 1
extension CGPoint {
static func =<T: FloatingPoint>(lhs: inout CGPoint, rhs: (T, T)){ // 2
lhs = CGPoint(x: rhs.0, y: rhs.1) // 3
}
}
Expected operator name in operator declaration I can't find anything saying that I'm not allowed to override the assignment operator, but that's what this sounds like.
Operator implementation without matching operator declaration Because the first line is invalid.
Cannot invoke initializer for type 'CGPoint' with an argument list of type '(x: T, y: T)' Could get rid of this by casting to Double, but is that the right way to go about this?