---
title: "init(for:migrationPlan:configurations:)"
framework: swiftdata
role: symbol
role_heading: Initializer
path: "swiftdata/modelcontainer/init(for:migrationplan:configurations:)-8s4ts"
---

# init(for:migrationPlan:configurations:)

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

## Declaration

```swift
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 doc://com.apple.SwiftData/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 doc://com.apple.SwiftData/documentation/SwiftData/ModelConfiguration.

## Discussion

Discussion important: A container must have at least one configuration. If you don’t specify any, the framework creates an instance of ModelConfiguration for you by combining your app’s entitlements with the type’s default values.

## See Also

### Creating a model container

- [init(for:migrationPlan:configurations:)](swiftdata/modelcontainer/init(for:migrationplan:configurations:)-1czix.md)
- [init(for:migrationPlan:configurations:)](swiftdata/modelcontainer/init(for:migrationplan:configurations:)-qof9.md)
- [PersistentModel](swiftdata/persistentmodel.md)
- [ModelConfiguration](swiftdata/modelconfiguration.md)
- [Schema](swiftdata/schema.md)
- [SchemaMigrationPlan](swiftdata/schemamigrationplan.md)
