<!--
{
  "availability" : [
    "iOS: 7.0.0 -",
    "iPadOS: 7.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UICollectionViewTransitionLayout/value(forAnimatedKey:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UICollectionViewTransitionLayout(im)valueForAnimatedKey:"
  },
  "title" : "value(forAnimatedKey:)"
}
-->

# value(forAnimatedKey:)

Returns the most recently set value for the specified key.

```
func value(forAnimatedKey key: String) -> CGFloat
```

## Parameters

`key`

A key whose value you set using the [`updateValue(_:forAnimatedKey:)`](/documentation/UIKit/UICollectionViewTransitionLayout/updateValue(_:forAnimatedKey:)) method.

## Return Value

The last value set for the key.

## Discussion

Use this method to retrieve floating-point values that are useful when laying out the contents of your collection view. The key you specify is a string that you define and that has some meaning to your implementation. At points during an interactive transition, you can assign new values to that key using the [`updateValue(_:forAnimatedKey:)`](/documentation/UIKit/UICollectionViewTransitionLayout/updateValue(_:forAnimatedKey:)) method.

---

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)