---
title: makeSharedContext()
framework: swiftui
role: symbol
role_heading: Type Method
path: swiftui/previewmodifier/makesharedcontext()-4zi8r
---

# makeSharedContext()

Create shared context to apply to previews. The context returned here will be cached and passed into the body method for every preview that applies a modifier of this type.

## Declaration

```swift
@MainActor static func makeSharedContext() async throws -> Self.Context
```
