<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "macOS: 14.0.0 -",
    "swift: 5.9.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftData",
  "identifier" : "/documentation/SwiftData/ModelContainer/init(for:migrationPlan:configurations:)-qof9",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftData"
    ],
    "preciseIdentifier" : "s:9SwiftData14ModelContainerC3for13migrationPlan14configurationsAcA6SchemaC_AA0i9MigrationG0_pXpSgAA0C13ConfigurationVdtKcfc"
  },
  "title" : "init(for:migrationPlan:configurations:)"
}
-->

# init(for:migrationPlan:configurations:)

Creates a model container using the specified schema, migration plan, and zero
or more configurations.

```
convenience init(for givenSchema: Schema, migrationPlan: (any SchemaMigrationPlan.Type)? = nil, configurations: ModelConfiguration...) throws
```

## Parameters

`givenSchema`

A schema that maps your app’s model classes to the associated data in the app’s persistent storage. For more information, see [`Schema`](/documentation/SwiftData/Schema).

`migrationPlan`

A plan that describes the evolution of your app’s schema and how the container migrates between specific versions. For more information, see [`SchemaMigrationPlan`](/documentation/SwiftData/SchemaMigrationPlan).

`configurations`

A list of configurations that describe how the container manages the persisted data for specific groups of models. For more information, see [`ModelConfiguration`](/documentation/SwiftData/ModelConfiguration).

## Discussion> Important: A container must have at least one configuration. If you don’t
> specify any, the framework creates an instance of ``doc://com.apple.SwiftData/documentation/SwiftData/ModelConfiguration`` for
> you by combining your app’s entitlements with the type’s default values.

---

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)