Search code examples
iosswiftcompiler-errorscore-graphics

CGPoint compiler error


I've tried to write an expression:

 var  moveDifference: CGPoint = CGPoint(touchPoint.x - self.anchorPointInPoints().x, touchPoint.y - self.anchorPointInPoints().y)

But xcode swears:

Argument labels '(_:, _:)' do not match any available overloads

Please help to fix that problem.

Thanks in advance.


Solution

  • You missed the argument labels on the CGPoint initializer:

    CGPoint(x: ..., y: ...)
    

    Also: thanks to type inference, you really don't need to redeclare your var type:

    var moveDifference = CGPoint(...