---
title: "defaultAction(forKey:)"
framework: quartzcore
role: symbol
role_heading: Type Method
path: "quartzcore/calayer/defaultaction(forkey:)"
---

# defaultAction(forKey:)

Returns the default action for the current class.

## Declaration

```swift
class func defaultAction(forKey event: String) -> (any CAAction)?
```

## Parameters

- `event`: The identifier of the action.

## Return Value

Return Value Returns a suitable action object for the given key or nil of no action object was associated with that key.

## Discussion

Discussion Classes that want to provide default actions can override this method and use it to return those actions.

## See Also

### Getting the layer’s actions

- [action(forKey:)](quartzcore/calayer/action(forkey:).md)
- [actions](quartzcore/calayer/actions.md)
