delete(_:)
Removes the specified model from the persistent storage during the next save operation.
Declaration
func delete<T>(_ model: T) where T : PersistentModelParameters
- model:
The persistent model to delete.
Discussion
When the context nexts commits its changes, SwiftData removes the model from the persistent storage. If the model is new and in an unsaved state, the context simply discards it.