问题
What is the best approach to iterate all SKSpriteNodes in a Scene using Swift?
回答1:
If your sprites have their name properties set, you can use enumeration closure:
self.enumerateChildNodesWithName(spriteName) {
            node, stop in
            // Do something with node.
}
    回答2:
I figured it out. Sample Swift code below.
self.enumerateChildNodesWithName("SomeSprite*", usingBlock: {
        (node: SKNode!, stop: UnsafeMutablePointer <ObjCBool>) -> Void in
        // do something with node or stop
            let action = SKAction.rotateByAngle(CGFloat(M_PI), duration:0.8)
            node.runAction(SKAction.repeatActionForever(action))
        }
    })
    来源:https://stackoverflow.com/questions/26112340/iterate-all-sprite-nodes-in-spritekit-using-swift