---
title: "setWidth(_:type:for:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstextblock/setwidth(_:type:for:)"
---

# setWidth(_:type:for:)

Sets the width of all edges of a specified layer of the text block.

## Declaration

```swift
func setWidth(_ width: CGFloat, type: NSTextBlock.ValueType, for layer: NSTextBlock.Layer)
```

## Parameters

- `type`: The type of value being provided. This controls how val is interpreted.
- `layer`: The layer of the text block to modify.

## See Also

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

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