AccessoryWidgetBackground
An adaptive background view that provides a standard appearance based on the the widget’s environment.
Declaration
@MainActor @preconcurrency struct AccessoryWidgetBackgroundMentioned 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
Supporting additional widget sizesDisplaying the right widget backgroundOptimizing your widget for accented rendering mode and Liquid GlassAdding StandBy and CarPlay support to your widgetWidgetRenderingModeWidgetAccentedRenderingModeWidgetLocationwidgetAccentable(_:)widgetAccentedRenderingMode(_:)widgetRenderingModewidgetContentMarginswidgetshowsWidgetContainerBackground