---
title: "setWidth(_:ofColumn:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsbrowser/setwidth(_:ofcolumn:)"
---

# setWidth(_:ofColumn:)

Sets the width of the specified column.

## Declaration

```swift
func setWidth(_ columnWidth: CGFloat, ofColumn columnIndex: Int)
```

## Parameters

- `columnWidth`: The new width of the specified column.
- `columnIndex`: The index of the column for which to set the width.

## Discussion

Discussion This method can be used to set the initial width of browser columns unless the column sizing is automatic; setWidth(_:ofColumn:) does nothing if columnResizingType is NSBrowser.ColumnResizingType.autoColumnResizing. To set the default width for new columns (that don’t otherwise have initial widths from defaults or via the delegate), use a columnIndex of –1. A value set for columnIndex of –1 is persistent. An columnConfigurationDidChangeNotification notification is posted (not immediately), if necessary, so that the browser can autosave the new column configuration.

## See Also

### Related Documentation

- [browser(_:shouldSizeColumn:forUserResize:toWidth:)](appkit/nsbrowserdelegate/browser(_:shouldsizecolumn:foruserresize:towidth:).md)

### Sizing

- [removeSavedColumns(withAutosaveName:)](appkit/nsbrowser/removesavedcolumns(withautosavename:).md)
- [columnsAutosaveName](appkit/nsbrowser/columnsautosavename-swift.property.md)
- [NSBrowser.ColumnsAutosaveName](appkit/nsbrowser/columnsautosavename-swift.typealias.md)
- [columnContentWidth(forColumnWidth:)](appkit/nsbrowser/columncontentwidth(forcolumnwidth:).md)
- [columnWidth(forColumnContentWidth:)](appkit/nsbrowser/columnwidth(forcolumncontentwidth:).md)
- [columnResizingType](appkit/nsbrowser/columnresizingtype-swift.property.md)
- [prefersAllColumnUserResizing](appkit/nsbrowser/prefersallcolumnuserresizing.md)
- [width(ofColumn:)](appkit/nsbrowser/width(ofcolumn:).md)
- [defaultColumnWidth()](appkit/nsbrowser/defaultcolumnwidth().md)
- [setDefaultColumnWidth(_:)](appkit/nsbrowser/setdefaultcolumnwidth(_:).md)
- [rowHeight](appkit/nsbrowser/rowheight.md)
