---
title: "width(for:edge:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstextblock/width(for:edge:)"
---

# width(for:edge:)

Returns the width of an edge of a specified layer of the text block.

## Declaration

```swift
func width(for layer: NSTextBlock.Layer, edge: NSRectEdge) -> CGFloat
```

## Parameters

- `layer`: The layer to examine.
- `edge`: The edge of the layer to examine.

## Return Value

Return Value The width of the edge of layer. This value must be interpreted according to the value type returned by widthValueType(for:edge:).

## See Also

### Getting and setting margins, borders, and padding

- [setWidth(_:type:for:edge:)](appkit/nstextblock/setwidth(_:type:for:edge:).md)
- [setWidth(_:type:for:)](appkit/nstextblock/setwidth(_:type:for:).md)
- [widthValueType(for:edge:)](appkit/nstextblock/widthvaluetype(for:edge:).md)
- [NSTextBlock.Layer](appkit/nstextblock/layer.md)
