<!--
{
  "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:)-8s4ts",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftData"
    ],
    "preciseIdentifier" : "s:9SwiftData14ModelContainerC3for13migrationPlan14configurationsAcA010PersistentC0_pXpd_AA015SchemaMigrationG0_pXpSgAA0C13ConfigurationVdtKcfc"
  },
  "title" : "init(for:migrationPlan:configurations:)"
}
-->

# init(for:migrationPlan:configurations:)

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

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

## Parameters

`forTypes`

A list of the persistent model types that comprise your app’s 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 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)