---
title: "action(forKey:)"
framework: spritekit
role: symbol
role_heading: Instance Method
path: "spritekit/sknode/action(forkey:)"
---

# action(forKey:)

Returns an action associated with a specific key.

## Declaration

```swift
func action(forKey key: String) -> SKAction?
```

## Parameters

- `key`: A string that uniquely identifies an action.

## Mentioned in

Controlling Actions Precisely by Using Names

## Return Value

Return Value If an action exists that matches the key, the action object is returned. Otherwise, nil is returned.

## See Also

### Running Actions

- [Getting Started with Actions](spritekit/getting-started-with-actions.md)
- [run(_:)](spritekit/sknode/run(_:).md)
- [run(_:completion:)](spritekit/sknode/run(_:completion:).md)
- [run(_:withKey:)](spritekit/sknode/run(_:withkey:).md)
- [speed](spritekit/sknode/speed.md)
- [isPaused](spritekit/sknode/ispaused.md)
- [hasActions()](spritekit/sknode/hasactions().md)
- [removeAllActions()](spritekit/sknode/removeallactions().md)
- [removeAction(forKey:)](spritekit/sknode/removeaction(forkey:).md)
