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

# background(_:)

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

## Declaration

```swift
func background<S>(_ style: S) -> UIHostingConfiguration<Content, _UIHostingConfigurationBackgroundView<S>> where S : ShapeStyle
```

## Parameters

- `style`: The shape style to be used as the background of the cell.

## Discussion

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

## See Also

### Setting the background

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