Contents

showsWidgetContainerBackground

An environment variable that indicates whether the background of a widget appears.

Declaration

var showsWidgetContainerBackground: Bool { get }

Return Value

true if, by default, the background appears in this context; false otherwise.

Discussion

In iOS 16 and earlier, this environment variable is always true for system widgets and false for accessory widgets. In macOS 13 and earlier, and in watchOS 9 and earlier, it always evaluates to true.

If you pass false to containerBackgroundRemovable(_:) to always show the widget background, the system shows the widget background even if showsWidgetContainerBackground evaluates to true.

See Also

Widgets