I'm trying to receive mutable variable from my array, but something goes wrong. Question in code.
var baloonsArray = NSMutableArray()
override func didMoveToView(view: SKView) {
var baloon = SKSpriteNode(imageNamed: "baloon") //"Variable "baloon" was never mutated; consider changing to "let" constant"
baloon.xScale = 0.1
baloon.yScale = 0.1
ballonsArray.addObject(baloon)
addChild(baloon)
}
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
for touch in touches {
for var baloon in baloonsArray {
baloon.xScale = 0.2 //Here xcode telling me: "Cannot assign to property: "ballon" is immutable". But i declared him as var. With Objective-C there was no problems. What should i do?
}
}
}
When Im trying to change baloon xScale in touchesBegan function xcode telling me: "Cannot assign to property: "ballon" is immutable". But i declared him as var. With Objective-C there was no problems. What should i do?