Reputation: 65
I have a code snippet:
hero.physicsBody?.applyImpulse(CGVectorMake(0, 250))
I get this error for this line:
CGVectorMake is unavailable in Swift
Upvotes: 1
Views: 4301
Reputation: 3599
In Swift 3 it has changed to CGVector()
hero.physicsBody?.applyImpulse(CGVector(dx: 0, dy: 250))
Upvotes: 16
Reputation: 1042
Change to:
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
hero.physicsBody?.applyImpulse(CGVector(dx: 0, dy: 250))
}
Upvotes: 2