AccessoryWidgetGroup
A view type that has a label at the top and three content views masked with a circle or rounded square.
Declaration
@MainActor @preconcurrency struct AccessoryWidgetGroup<Label, Content> where Label : View, Content : ViewOverview
You can use this view on .accessoryRectangular family widgets on watchOS to lay out three content views horizontally inside of a rectangular widget.
Example usage:
struct WeatherGroupView: View {
var entry: Provider.Entry
var body: some View {
AccessoryWidgetGroup("Weather", systemImage: "cloud.sun.fill") {
TemperatureWidgetView(entry.temperature)
ConditionsWidgetView(entry.conditions)
UVIndexWidgetView(entry.UVIndex)
}
.accessoryWidgetGroupStyle(.circular)
}
}The above example creates an .accessoryRectangular widget that has a SwiftUI.Label as its label and has three content views: temperature, conditions, and UVIndex; all of which are circular. If the developers provide fewer than three views, the AccessoryWidgetGroup will insert however many custom empty view(s) to ensure that three views exist in the content.
You can change the shape with which the content views are masked using the .accessoryWidgetGroupStyle(_:) view modifier.