---
title: "init(merge:)"
framework: coredata
role: symbol
role_heading: Initializer
path: "coredata/nsmergepolicy/init(merge:)"
---

# init(merge:)

Returns a merge policy initialized with a given policy type.

## Declaration

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

## Parameters

- `ty`: A merge policy type.

## Return Value

Return Value A merge policy initialized with a given policy type.

## Discussion

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:) 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

### Related Documentation

- [Core Data Model Versioning and Data Migration Programming Guide](apple-archive/documentation/Cocoa/Conceptual/CoreDataVersioning/Articles/Introduction.html.md)

### Getting a Merge Policy

- [mergeType](coredata/nsmergepolicy/mergetype.md)
