---
title: "withSize(_:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uifont/withsize(_:)"
---

# withSize(_:)

Returns a font object that is the same as the font, but has the specified size.

## Declaration

```swift
func withSize(_ fontSize: CGFloat) -> UIFont
```

## Parameters

- `fontSize`: The desired size (in points) of the new font object. This value must be greater than 0.0.

## Return Value

Return Value A font object of the specified size.

## See Also

### Creating Fonts

- [Scaling fonts automatically](uikit/scaling-fonts-automatically.md)
- [Creating self-sizing table view cells](uikit/creating-self-sizing-table-view-cells.md)
- [preferredFont(forTextStyle:)](uikit/uifont/preferredfont(fortextstyle:).md)
- [preferredFont(forTextStyle:compatibleWith:)](uikit/uifont/preferredfont(fortextstyle:compatiblewith:).md)
- [UIFont.TextStyle](uikit/uifont/textstyle.md)
- [init(name:size:)](uikit/uifont/init(name:size:).md)
- [init(descriptor:size:)](uikit/uifont/init(descriptor:size:).md)
