---
title: "value(forKey:)"
framework: scenekit
role: symbol
role_heading: Type Method
path: "scenekit/scntransaction/value(forkey:)"
---

# value(forKey:)

Returns the object previously associated with the current transaction using the specified key.

## Declaration

```swift
class func value(forKey key: String) -> Any?
```

## Parameters

- `key`: The unique string identifying an object previously associated with the transaction.

## Return Value

Return Value The object previously associated with the transaction (or an enclosing transaction) using the specified key, or nil if no value for that key could be found.

## Discussion

Discussion Nested transactions have nested data scope. Setting a value for a key associates it with the current transaction (or innermost nested transaction) only, but reading the value for a key searches through nested transactions (starting from the innermost).

## See Also

### Getting and Setting Transaction Properties

- [setValue(_:forKey:)](scenekit/scntransaction/setvalue(_:forkey:).md)
