---
title: "delete(model:where:includeSubclasses:)"
framework: swiftdata
role: symbol
role_heading: Instance Method
path: "swiftdata/modelcontext/delete(model:where:includesubclasses:)"
---

# delete(model:where:includeSubclasses:)

Removes each model satisfying the given predicate from the persistent storage during the next save operation.

## Declaration

```swift
func delete<T>(model: T.Type, where predicate: Predicate<T>? = nil, includeSubclasses: Bool = true) throws where T : PersistentModel
```

## Parameters

- `model`: The type of the model to remove.
- `predicate`: The logical condition to use when determining if the context should remove a particular model. The default value is nil.
- `includeSubclasses`: A Boolean value that indicates whether the context includes subclasses of the specified model type when evaluating models to remove. The default value is true.

## Discussion

Discussion warning: If you don’t provide a predicate, the context will remove all models of the specified type from the persistent storage.

## See Also

### Deleting models

- [deletedModelsArray](swiftdata/modelcontext/deletedmodelsarray.md)
- [delete(_:)](swiftdata/modelcontext/delete(_:).md)
