I wonder how the + function is used directly.
extension CGPoint {
static func add(lhs: Self, rhs: Self) -> CGPoint {
CGPoint(x: lhs.x + rhs.x, y: lhs.y + rhs.y)
}
static func +(lhs: Self, rhs: Self) -> CGPoint {
CGPoint(x: lhs.x + rhs.x, y: lhs.y + rhs.y)
}
}
private func testCGPoint() {
let dummy1 = CGPoint(x: 2, y: 3)
let dummy2 = CGPoint(x: 4, y: 5)
let dummy3: CGPoint = .add(lhs: dummy1, rhs: dummy2)
let dummy4: CGPoint = dummy1 + dummy2
}
in my expectation, I thought that the + function would be used like the add function. i thought this form.
CGPoint.+(lhs: dummy1, rhs: dummy2)
But the + function did not.
How are you doing this?