在Spritekit swift中它说:预期声明

时间:2016-06-10 00:46:42

标签: ios swift sprite-kit

我在SpriteKit swift编程,突然间我得到了这个错误,

  

"预期宣言"

以下是我收到错误的代码:

    for touch in touches {
            print(touch)
        }

    func Enemies(){
        print("enemies")
    }

    override func update(currentTime: CFTimeInterval) {
        /* Called before each frame is rendered */
    }
}

1 个答案:

答案 0 :(得分:0)

这是因为您无法在任何地方声明for语句。您很可能需要将其放在touchesBegan方法中。