---
title: "sizeThatFits(_:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nscontrol/sizethatfits(_:)"
---

# sizeThatFits(_:)

Asks the control to calculate and return the size that best fits the specified size.

## Declaration

```swift
func sizeThatFits(_ size: NSSize) -> NSSize
```

## Parameters

- `size`: The size for which the control should calculate its best-fitting size.

## Return Value

Return Value A new size that fits the receiver’s subviews.

## Discussion

Discussion By default, this method returns the intrinsicContentSize of the receiver.

## See Also

### Resizing the Control

- [controlSize](appkit/nscontrol/controlsize-swift.property.md)
- [NSControl.ControlSize](appkit/nscontrol/controlsize-swift.enum.md)
- [sizeToFit()](appkit/nscontrol/sizetofit().md)
