---
title: sizeToFitWidth()
framework: watchkit
role: symbol
role_heading: Instance Method
path: watchkit/wkinterfaceobject/sizetofitwidth()
---

# sizeToFitWidth()

Sets the width of the object to fit its current content.

## Declaration

```swift
func sizeToFitWidth()
```

## Discussion

Discussion This method is equivalent of using the Size to Fit Content option in Interface Builder. It sizes the object so that its width matches the width of its content. For example, calling this method on a label sets the width of the label to the width of its text. The width of an object never exceeds the width of its container. Changes to the width of an object are animatable.

## See Also

### Changing an Object’s Size

- [setWidth(_:)](watchkit/wkinterfaceobject/setwidth(_:).md)
- [setHeight(_:)](watchkit/wkinterfaceobject/setheight(_:).md)
- [setRelativeWidth(_:withAdjustment:)](watchkit/wkinterfaceobject/setrelativewidth(_:withadjustment:).md)
- [setRelativeHeight(_:withAdjustment:)](watchkit/wkinterfaceobject/setrelativeheight(_:withadjustment:).md)
- [sizeToFitHeight()](watchkit/wkinterfaceobject/sizetofitheight().md)
