# `GSFont setCustomValue:forKey:`

*Instance Method*

Sets the value of a custom parameter.

## Declaration

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

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

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

## Parameters

- `value` — The value to store, or `nil` to remove the custom parameter.
- `key` — The custom parameter name.

## Discussion

An existing custom parameter with the same name is updated. Otherwise a new custom parameter is added. Passing `nil` removes the first matching custom parameter.

## See Also

### Custom Parameters

- [`GSFont.customParameters`](/Core/GlyphsCore/GSFont/customParameters) — Custom parameters stored in the font.
- [`GSFont countOfCustomParameters`](/Core/GlyphsCore/GSFont/countOfCustomParameters) — The number of custom parameters.
- [`GSFont objectInCustomParametersAtIndex:`](/Core/GlyphsCore/GSFont/objectInCustomParametersAtIndex:) — The custom parameter at an index.
- [`GSFont customParameterForKey:`](/Core/GlyphsCore/GSFont/customParameterForKey:) — The first custom parameter with a name.
- [`GSFont customParameterActiveForKey:`](/Core/GlyphsCore/GSFont/customParameterActiveForKey:) — The first active custom parameter with a name.
- [`GSFont customValueForKey:`](/Core/GlyphsCore/GSFont/customValueForKey:) — The value of an active custom parameter.
- [`GSFont customBoolValueForKey:`](/Core/GlyphsCore/GSFont/customBoolValueForKey:) — The Boolean value of an active custom parameter.
- [`GSFont customColorValueForKey:`](/Core/GlyphsCore/GSFont/customColorValueForKey:) — The color value of an active custom parameter.
- [`GSFont addCustomParameter:`](/Core/GlyphsCore/GSFont/addCustomParameter:) — Adds a custom parameter.
- [`GSFont insertObject:inCustomParametersAtIndex:`](/Core/GlyphsCore/GSFont/insertObject:inCustomParametersAtIndex:) — Inserts a custom parameter at an index.
- [`GSFont removeObjectFromCustomParameters:`](/Core/GlyphsCore/GSFont/removeObjectFromCustomParameters:) — Removes a custom parameter.
- [`GSFont removeObjectFromCustomParametersAtIndex:`](/Core/GlyphsCore/GSFont/removeObjectFromCustomParametersAtIndex:) — Removes the custom parameter at an index.
- [`GSFont removeObjectFromCustomParametersForKey:`](/Core/GlyphsCore/GSFont/removeObjectFromCustomParametersForKey:) — Removes the first custom parameter with a name.
- [`GSFont replaceObjectInCustomParametersAtIndex:withObject:`](/Core/GlyphsCore/GSFont/replaceObjectInCustomParametersAtIndex:withObject:) — Replaces the custom parameter at an index.
- [`GSFont invalidateCustomParameterCache`](/Core/GlyphsCore/GSFont/invalidateCustomParameterCache) — Invalidates cached active custom parameter values.

