<!--
{
  "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/NSMergePolicy/init(merge:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Core Data"
    ],
    "preciseIdentifier" : "c:objc(cs)NSMergePolicy(im)initWithMergeType:"
  },
  "title" : "init(merge:)"
}
-->

# init(merge:)

Returns a merge policy initialized with a given policy type.

```
init(merge ty: NSMergePolicyType)
```

## Parameters

`ty`

A merge policy type.

## Return Value

A merge policy initialized with a given policy type.

## Discussion

If you override this method in a subclass, you should invoke the superclass’s implementation with the merge policy that is closest to the behavior you want.

- This will make it easier to use the superclass’s implementation of [`resolve(mergeConflicts:)`](/documentation/CoreData/NSMergePolicy/resolve(mergeConflicts:)) and then customize the results.
- Due to the complexity of merging to-many relationships, this class is designed with the expectation that you call super as the base implementation.

## See Also

  [Core Data Model Versioning and Data Migration Programming Guide](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CoreDataVersioning/Articles/Introduction.html#//apple_ref/doc/uid/TP40004399)



---

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)