How to use CGPointMake
in Swift
? Is there an equivalent for it? I am getting an error:
Use of unresolved identifier 'CGPointMake'
Basically, I am trying to assign a position to a Sprite Kit node and cannot figure out how to do it in Swift.
class PlayerSpaceship: Spaceship { func launchMissile() { var missile = Missile.playerMissile() // This line gives above mentioned error. missile.position = CGPointMake(0.0, 0.0) } }
CGPoint is a struct used to represent an x and y coordinate in a 2D plane. This post presents examples of how Lottie and Charts, two popular Cocoapods with over 44,000 combined GitHub stars, use CGPoint in Swift: Compute CGRect Corners and Center. Describe A CoreGraphics Path. Respond To Rotation Gestures.
A structure that contains the location and dimensions of a rectangle.
Use CGPoint(x: Float, y: Float)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With