---
title: "run(_:onChildWithName:)"
framework: spritekit
role: symbol
role_heading: Type Method
path: "spritekit/skaction/run(_:onchildwithname:)"
---

# run(_:onChildWithName:)

Creates an action that runs an action on a named child object.

## Declaration

```swift
class func run(_ action: SKAction, onChildWithName name: String) -> SKAction
```

## Parameters

- `action`: The action to execute.
- `name`: The name of a child object. See the doc://com.apple.spritekit/documentation/SpriteKit/SKNode/name property on the doc://com.apple.spritekit/documentation/SpriteKit/SKNode object.

## Return Value

Return Value A new action object.

## Discussion

Discussion Because this action references child nodes by name, it is especially handy for nodes that the scene subclass (or scene delegate) does not maintain a reference to, for example, child nodes that are defined in an .sks file. This action has an instantaneous duration, although the action executed on the child may have a duration of its own. When the action executes, it looks up an appropriate child node and calls its run(_:) method, passing in the action to execute. This action is reversible; it tells the child to execute the reverse of the action specified by the action parameter.
