---
title: preferredTextFieldWidth()
framework: appkit
role: symbol
role_heading: Instance Method
path: appkit/nsform/preferredtextfieldwidth()
---

# preferredTextFieldWidth()

The preferred width of the form’s cells when using Auto Layout.

## Declaration

```swift
func preferredTextFieldWidth() -> CGFloat
```

## Return Value

Return Value The field’s width.

## Discussion

Discussion If the width is negative, the cellSize matches the historic behavior, which is that it is large enough to accommodate the title, bezel, and the current text. The default is -1.

## See Also

### Auto Layout Sizing

- [setPreferredTextFieldWidth(_:)](appkit/nsform/setpreferredtextfieldwidth(_:).md)
