<!--
{
  "availability" : [
    "macOS: 10.0.0 - 27.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextBlock/setWidth(_:type:for:edge:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSTextBlock(im)setWidth:type:forLayer:edge:"
  },
  "title" : "setWidth(_:type:for:edge:)"
}
-->

# setWidth(_:type:for:edge:)

Sets the width of a specified edge of a specified layer of the text block.

```
func setWidth(_ val: CGFloat, type: NSTextBlock.ValueType, for layer: NSTextBlock.Layer, edge: NSRectEdge)
```

## Parameters

`val`

The new value for the specified edge width.

`type`

The type of value being provided. This controls how `val` is interpreted.

`layer`

The layer of the text block to modify.

`edge`

The edge of the layer to modify.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)