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

# init(for:migrationPlan:configurations:)

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

## Declaration

```swift
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 doc://com.apple.SwiftData/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 doc://com.apple.SwiftData/documentation/SwiftData/SchemaMigrationPlan.
- `configurations`: An array of 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 specify an empty array, 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:)-8s4ts.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)
