---
title: "fontWeight(_:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/fontweight(_:)"
---

# fontWeight(_:)

Sets the font weight of the text in this view.

## Declaration

```swift
nonisolated func fontWeight(_ weight: Font.Weight?) -> some View

```

## Parameters

- `weight`: One of the available font weights. Providing nil removes the effect of any font weight modifier applied higher in the view hierarchy.

## Return Value

Return Value A view that uses the font weight you specify.

## See Also

### Setting a font

- [Applying custom fonts to text](swiftui/applying-custom-fonts-to-text.md)
- [font(_:)](swiftui/view/font(_:).md)
- [fontDesign(_:)](swiftui/view/fontdesign(_:).md)
- [fontWidth(_:)](swiftui/view/fontwidth(_:).md)
- [font](swiftui/environmentvalues/font.md)
- [Font](swiftui/font.md)
