---
title: "init(_:)"
framework: swiftdata
role: symbol
role_heading: Initializer
path: "swiftdata/modelcontext/init(_:)"
---

# init(_:)

Creates a context that belongs to the specified model container.

## Declaration

```swift
init(_ container: ModelContainer)
```

## Parameters

- `container`: The model container to associate with the initialized context.

## Discussion

Discussion Use the context’s container property to access the model container after initializtion.

## See Also

### Creating a model context

- [ModelContainer](swiftdata/modelcontainer.md)
