<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/AttachmentContentBuilder/buildIf(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "RealityKit",
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:19_RealityKit_SwiftUI24AttachmentContentBuilderV7buildIfyxSgAeA0eF0RzlFZ"
  },
  "title" : "buildIf(_:)"
}
-->

# buildIf(_:)

Provides support for “if” statements in multi-statement closures,
producing an optional view that is visible only when the condition
evaluates to `true`.

```
static func buildIf<Content>(_ content: Content?) -> Content? where Content : AttachmentContent
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)