Contents

background(_:)

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

Declaration

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

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