Cannot convert value of type int to specified value CGPoint

I have some code that is supposed to swipe a sprite in any direction taking in an initial value of a CGPoint.

I tried setting up a variable for this as

    var initialLocation:CGPoint = 0 

I know this is not how you’re supposed to do it but I forgot how it goes.

Add Comment
1 Answer(s)

It’s a point, so it has to have two coordinates (x, y):

var initialLocation: CGPoint = .zero 

or

var initialLocation: CGPoint = CGPoint(x: 0, y: 0) 
Answered on August 31, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.