---
title: "background(content:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/uihostingconfiguration/background(content:)"
---

# background(content:)

Sets the background contents for the hosting configuration’s enclosing cell.

## Declaration

```swift
func background<B>(@ContentBuilder content: () -> B) -> UIHostingConfiguration<Content, B> where B : View
```

## Discussion

Discussion The following example sets a custom view to the background of the cell: UIHostingConfiguration {     Text("My Contents") } .background {     MyBackgroundView() }

## See Also

### Setting the background

- [background(_:)](swiftui/uihostingconfiguration/background(_:).md)
