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

# setWidth(_:type:for:)

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

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

## Parameters

`width`

The new value for the specified edge width.

`type`

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

`layer`

The layer of the text block 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)