<!--
{
  "availability" : [
    "iOS: 5.0.0 -",
    "iPadOS: 5.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.7.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreData",
  "identifier" : "/documentation/CoreData/NSSaveChangesRequest/init(inserted:updated:deleted:locked:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Core Data"
    ],
    "preciseIdentifier" : "c:objc(cs)NSSaveChangesRequest(im)initWithInsertedObjects:updatedObjects:deletedObjects:lockedObjects:"
  },
  "title" : "init(inserted:updated:deleted:locked:)"
}
-->

# init(inserted:updated:deleted:locked:)

Initializes a save changes request with collections of given changes.

```
init(inserted insertedObjects: Set<NSManagedObject>?, updated updatedObjects: Set<NSManagedObject>?, deleted deletedObjects: Set<NSManagedObject>?, locked lockedObjects: Set<NSManagedObject>?)
```

## Parameters

`insertedObjects`

Objects that were inserted into the calling context.

`updatedObjects`

Objects that were updated in the calling context.

`deletedObjects`

Objects that were deleted in the calling context.

`lockedObjects`

Objects that were flagged for optimistic locking on the calling context.

## Return Value

A save changes request initialized with the given changes.

---

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)