WidgetPreviewContext
A specification for the context of a widget preview.
Declaration
struct WidgetPreviewContextOverview
To create a preview for a widget in Xcode, use previewContext(_:) and pass WidgetPreviewContext initialized with the appropriate WidgetFamily.
struct Widget_Previews: PreviewProvider {
static var previews: some View {
Group {
MyWidgetView()
.previewContext(WidgetPreviewContext(family: .systemSmall))
}
}
}