Reputation: 21
I have updated to swift 2 and the migration tool has not been able to update my arrays. Here is where I am getting the errors:
actionArray.addObject(SKAction.moveTo(CGPointMake(position, -alien.size.height), duration: NSTimeInterval(duration)))
actionArray.addObject(SKAction.removeFromParent())
actionArray2.addObject(SKAction.moveTo(CGPointMake(position, -alienAzul.size.height), duration: NSTimeInterval(duration)))
actionArray2.addObject(SKAction.removeFromParent())
This is what it says:
Value of type '[SKAction]' has no member 'addObject'
Upvotes: 0
Views: 343
Reputation: 9389
Best practices for Swift is to use Arrays as follows:
Define your array variable as
var actionArray: [SKAction]!
Instantiate it:
actionArray = [SKAction]()
Add objects to it with:
actionArray.append(sKAction)
Upvotes: 1