---
title: "buildIf(_:)"
framework: charts
role: symbol
role_heading: Type Method
path: "charts/chartcontentbuilder/buildif(_:)"
---

# buildIf(_:)

Builds a partial result that’s conditionally present.

## Declaration

```swift
static func buildIf<T>(_ content: T?) -> T? where T : ChartContent
```

## Parameters

- `content`: The content to use if the condition is true.

## Discussion

Discussion This method provides support for if statements. It produces optional chart content that is visible only when the condition evaluates to true.

## See Also

### Building conditionally

- [buildEither(first:)](charts/chartcontentbuilder/buildeither(first:).md)
- [buildEither(second:)](charts/chartcontentbuilder/buildeither(second:).md)
