=== This package provides an easy way to perform deep copies of Core Data objects, and an easy way to export and import deep-copied managed objects in a shareable document. It can support sophisticated Core Data object graphs with customization options.
EasyDocumentincludes support for relationships that are either ordered or unordered, and one-to-many or many-to-many. Inverse relationships are also properly configured.
let package = Package( name: ... dependencies: [ .package(url: "https://github.com/alekseyn/EasyDocument") ], targets: ... )
Start with adding an import statement.
For best results, your Core Data model must be properly configured. In particular, entities that have an 'ownership' relationship with another entity should have a Cascade relationship deletion rule.
EasyDocument only performs a deep copy of entity relationships that are marked with a Cascade deletion rule. Related entities that have any other deletion rule are ignored. This is critical to ensure the proper ordering of ordered relationships. However, this can be customized.
Deep copy of a managed object is straightforward.
You can find unit tests in
EasyDocumentTests target. Press
⌘+U to run tests in Xcode.