Contents

background(content:)

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

Declaration

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

Parameters

  • content:

    The contents of the SwiftUI hierarchy to be shown inside the background of the cell.

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