CGPointMake in Swift

RaffAl picture RaffAl · Jun 5, 2014 · Viewed 32.6k times · Source

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) 
    }
}

Answer

Joseph Mark picture Joseph Mark · Jun 5, 2014

Use CGPoint(x: Float, y: Float)