Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CGPointMake in Swift

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)      } } 
like image 509
Rafa de King Avatar asked Jun 05 '14 21:06

Rafa de King


People also ask

What is CGPoint in Swift?

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.

What is CGRect in Swift?

A structure that contains the location and dimensions of a rectangle.


1 Answers

Use CGPoint(x: Float, y: Float)

like image 106
Joseph Mark Avatar answered Sep 20 '22 02:09

Joseph Mark