I am experimenting with SpriteKit in Swift, but for some reason seems unable to create an array of actions to use in a sequence. I split it to try to identify the problem, but so far no luck.
func animateBackground(){ let moveLeft = SKAction.moveByX(100, y: 0, duration: 3) moveLeft.timingMode = SKActionTimingMode.EaseInEaseOut let moveRight = SKAction.reversedAction(moveLeft) let actions = [moveLeft, moveRight] // <--- here there be dragons/trouble let sequence = SKAction.sequence(actions) let repeat = SKAction.repeatActionForever(sequence) }
When I try to create an actions array, I get the error message โIt is not possible to convert the type of the expressionโ Array โto the typeโ ArrayLiteralConvertible. โSo, I thought that I might need a more explicit one and try to change it to
var actions: SKAction[] = [moveLeft, moveRight]
This seemed to knock down the house, not in a good way, causing SourceKit to complete the error ...
source share