Contents

insert(_:)

Registers the specified model with the context so it can include the model in the next save operation.

Declaration

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

Parameters

  • model:

    The model to include in the next save operation.

Discussion

A model is given a temporary persistent identifier until the first time a context saves it, after which that context assigns a permanent identifier. If you call rollback() after inserting a model but before the next save operation, the context discards that model.

See Also

Inserting models