displaySize
TypeScriptget displaySize(): { width: number; height: number }Swift declarationlet displaySize: CGSizeThe size, in points, of the widget.
struct · iOS 14.0+ · SDK 27.1
struct TimelineProviderContextAn object that contains details about how a widget is rendered, including its size and whether it appears in the widget gallery. When requesting timelines for a widget, WidgetKit passes the <doc:TimelineProvider> a context object that includes details about how the widget appears. These details include: * The <doc:WidgetKit/WidgetFamily>; for example, <doc:WidgetKit/WidgetFamily/systemSmall> and <doc:WidgetKit/WidgetFamily/systemMedium>. * The size, in points, of the widget. * Variants of the environments where the widget might appear. * Whether the widget appears as a preview in the widget gallery. If your widget uses assets that take time to generate or depend on the specific environment they're rendered in, you can use the environment variants to generate those assets in advance. Some of the common environment properties to consider include: * <doc://com.apple.documentation/documentation/swiftui/environmentvalues/colorscheme>, where you use different assets for light and dark schemes. * <doc://com.apple.documentation/documentation/swiftui/environmentvalues/displayscale>, where your widget might appear in both @1x and @2x displays on macOS devices. To be responsive when the environment changes, WidgetKit may render the widget's view in advance. For example, WidgetKit renders both light and dark versions of the widget so that if the color scheme changes, the correct version is immediately available.
get displaySize(): { width: number; height: number }Swift declarationlet displaySize: CGSizeThe size, in points, of the widget.
get environmentVariants(): TimelineProviderContext_EnvironmentVariantsSwift declarationlet environmentVariants: TimelineProviderContext.EnvironmentVariantsAll environment values that might be set when a widget appears.
get family(): WidgetFamilySwift declarationlet family: WidgetFamilyThe user-configured family of the widget: small, medium, or large.
get isPreview(): booleanSwift declarationlet isPreview: BoolA Boolean value that indicates when the widget appears in the widget gallery.
No declarations were skipped in this snapshot.