<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: -",
    "macOS: 11.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WidgetKit",
  "identifier" : "/documentation/WidgetKit/TimelineProvider/getSnapshot(in:completion:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WidgetKit"
    ],
    "preciseIdentifier" : "s:9WidgetKit16TimelineProviderP11getSnapshot2in10completionyAA0cD7ContextV_y5EntryQzctF"
  },
  "title" : "getSnapshot(in:completion:)"
}
-->

# getSnapshot(in:completion:)

Provides a timeline entry that represents the current time and state of a
widget.

```
@preconcurrency func getSnapshot(in context: Self.Context, completion: @escaping @Sendable (Self.Entry) -> Void)
```

## Parameters

`context`

An object describing the context to show the widget in.

`completion`

The completion handler to call after you create the
snapshot entry.

## Discussion

WidgetKit calls `getSnapshot(in:completion:)` when the widget
appears in transient situations. If `context.isPreview` is `true`, the
widget appears in the widget gallery. In that case, call the
`completion` handler as quickly as possible, perhaps supplying sample
data if it could take more than a few seconds to fetch or calculate the
widget’s current state.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)