Skip to content

Decodable Object prevent duplicates #18

@darnat

Description

@darnat

The code works perfectly fine, but something is missing.
What if when I'm tryin to decode a JSON with my NSManagedObject Codable Model, but this object already exist. I mean to say for exemple that I already have in my Database an Object with the same primaryKey. And I don't want to have a duplicate, just update the existing one.

Since I don't really have the control when init(from decoder: Decoder) is called. How can I perform an NSRequest and return the object if it exist or create a new One. Exactly like the Person and its dogs but at the root level ?

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions