<!--
{
  "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/ModelContext/delete(model:where:includeSubclasses:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftData"
    ],
    "preciseIdentifier" : "s:9SwiftData12ModelContextC6delete5model5where17includeSubclassesyxm_10Foundation9PredicateVyx_QPGSgSbtKAA010PersistentC0RzlF"
  },
  "title" : "delete(model:where:includeSubclasses:)"
}
-->

# delete(model:where:includeSubclasses:)

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

```
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> Warning: If you don’t provide a predicate, the context will remove all models
> of the specified type from the persistent storage.

---

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)