# `GSBaseObject setTempData:forKey:`

*Instance Method*

Sets or removes a temporary value.

## Declaration

```swift
func setTempData(_ value: Any?, forKey key: String)
```

```objc
- (void) setTempData:(id) value forKey:(NSString *) key;
```

```python
setTempData_forKey_(value: object, key: str)
```

## Parameters

- `value` — The value to set, or `nil` to remove the temporary value.

## Discussion

Passing `nil` as the value removes the temporary value.

## See Also

### Temporary Data

- [`GSBaseObject.tempData`](/Core/GlyphsCore/GSBaseObject/tempData) — Values associated with the object for transient use.
- [`GSBaseObject countOfTempData`](/Core/GlyphsCore/GSBaseObject/countOfTempData) — The number of temporary values.
- [`GSBaseObject tempDataForKey:`](/Core/GlyphsCore/GSBaseObject/tempDataForKey:) — The temporary value for a key, or `nil` if no value is set.

