Contents

AccessoryWidgetBackground

An adaptive background view that provides a standard appearance based on the the widget’s environment.

Declaration

@MainActor @preconcurrency struct AccessoryWidgetBackground

Mentioned in

Overview

Use this view to provide a standardized background for your accessory widgets. Place the view in a ZStack behind your widget’s content.

ZStack {
    AccessoryWidgetBackground()
    VStack {
        Text("MON")
            .font(.caption)
            .widgetAccentable()
        Text("6")
            .font(.title)
    }
}

The system only displays this view inside a WidgetFamily.accessoryCircular, WidgetFamily.accessoryCorner, or WidgetFamily.accessoryRectangular widget. In any other context, the system displays an empty view instead.

Topics

Creating accessory widget backgrounds

See Also

Layout and presentation