<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.5.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "QuartzCore",
  "identifier" : "/documentation/QuartzCore/CALayer/defaultAction(forKey:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Core Animation"
    ],
    "preciseIdentifier" : "c:objc(cs)CALayer(cm)defaultActionForKey:"
  },
  "title" : "defaultAction(forKey:)"
}
-->

# defaultAction(forKey:)

Returns the default action for the current class.

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

## Parameters

`event`

The identifier of the action.

## Return Value

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

## Discussion

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

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)