---
title: "value(forAnimatedKey:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nscollectionviewtransitionlayout/value(foranimatedkey:)"
---

# value(forAnimatedKey:)

Returns the most recently set value for the specified key.

## Declaration

```swift
func value(forAnimatedKey key: NSCollectionViewTransitionLayout.AnimatedKey) -> CGFloat
```

## Parameters

- `key`: A key whose value you set previously using the doc://com.apple.appkit/documentation/AppKit/NSCollectionViewTransitionLayout/updateValue(_:forAnimatedKey:) method.

## Return Value

Return Value The last value set for the key.

## Discussion

Discussion Use this method to retrieve floating-point values that relate to 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 layout’s implementation. At points during an interactive transition, you can assign new values to that key using the updateValue(_:forAnimatedKey:) method.

## See Also

### Updating the Transition Information

- [transitionProgress](appkit/nscollectionviewtransitionlayout/transitionprogress.md)
- [updateValue(_:forAnimatedKey:)](appkit/nscollectionviewtransitionlayout/updatevalue(_:foranimatedkey:).md)
- [NSCollectionViewTransitionLayout.AnimatedKey](appkit/nscollectionviewtransitionlayout/animatedkey.md)
