Last Run on XCODE 11.4 / Swift 5.2

Spritekit has a method enumerateChildNodes that searches the children of the receiving node to perform processing for nodes that share a name.

In the code snippet below, we are are iterating through all the nodes with the name “trafficCar” in the parent node (or SKScene) and performing some action on it.

func moveTraffic() {
    enumerateChildNodes(withName: "trafficCar") { 
        (trafficCar, stop) in
        let car = trafficCar as! SKSpriteNode
        car.position.y -= 10
        }
    }