---
title: "scaledValue(for:compatibleWith:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uifontmetrics/scaledvalue(for:compatiblewith:)"
---

# scaledValue(for:compatibleWith:)

Scales an arbitrary layout value based on the current Dynamic Type settings and the specified traits.

## Declaration

```swift
func scaledValue(for value: CGFloat, compatibleWith traitCollection: UITraitCollection?) -> CGFloat
```

## Parameters

- `value`: The height value that you want to scale. Specify the height of the object that contains the text (at the standard Dynamic Type size) that you want to display.
- `traitCollection`: The trait collection to use when determining compatibility. The returned value is appropriate for use in an interface that adopts the specified traits.

## Return Value

Return Value A layout height that is scaled appropriately to accommodate the text that you want to display.

## Discussion

Discussion Use this method to scale the height of visual elements containing text. For example, if you define a button with text that can scale based on Dynamic Type, you would use this method to obtain an appropriately scaled height for your button’s background content.

## See Also

### Scaling Layout Values

- [scaledValue(for:)](uikit/uifontmetrics/scaledvalue(for:).md)
