Contents

delete(_:)

Removes the specified model from the persistent storage during the next save operation.

Declaration

func delete<T>(_ model: T) where T : PersistentModel

Parameters

  • 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.

See Also

Deleting models