I have a problem with swift on XCode 6 beta 4, is driving me nuts I'm in IOS 8 developing a game and I have follow a tutorial but I get this: Float is not convertible to CGFloat and then when I recast as CGFloat I get the other. Here is the code:
override func didMoveToView(view: SKView) {
/* Setup your scene here */
//physics
self.physicsWorld.gravity = CGVectorMake(0.0, -5.0)
// Bird
var birdTexture = SKTexture(imageNamed: "kirby")
birdTexture.filteringMode = SKTextureFilteringMode.Nearest
bird.setScale(0.5)
bird.position = CGPoint(x: self.frame.size.width * 0.35, y: self.frame.size.height * 0.6)
bird.physicsBody = SKPhysicsBody(circleOfRadius:bird.size.height/2)
bird.physicsBody.dynamic = true
bird.physicsBody.allowsRotation = false
self.addChild(bird)
//ground
ground.setScale(2.0)
ground.position = CGPointMake(self.size.width/2, ground.size.height/2)
ground.physicsBody = SKPhysicsBody(rectangleOfSize: CGSizeMake(self.frame.size.width , ground.size.height))
ground.physicsBody.dynamic = false
self.addChild(ground)
//pipes
//create pipes
//^
//movement of the pipes
let distanceToMove = CGFloat(self.frame.size.width + 2.0 * pipeUp.texture.size().width)
let movePipe = SKAction.moveByX(-distanceToMove, y: CGFloat(0.0), duration: NSTimeInterval(0.01) * distanceToMove) <----- this line is the problem
}
What is going on, I move the line:
CGFloat(self.frame.size.width + 2.0 * pipeUp.texture.size().width)
I get the second error, then a recast:
Float(CGFloat(self.frame.size.width + 2.0 * pipeUp.texture.size().width))
or
Float(self.frame.size.width + 2.0 * pipeUp.texture.size().width)
gives me the first, so what do swift wants here, that is insane. Catch 22? Any help?
EDIT: I'm using a 13-inch mac late 2009, Intel Core 2 Duo, on mavericks OS X 10.9.4 (13E28) if any help. I saw something about the building options may affect the float types, but I do not know where are they.