Actually the above will wipe all of your records because it doesn't select the winning objectID out of the collection of multiple results. Any good database design begins with data normalization, unique keys etc ...: Take a look at the following code by apple on how to dedupe core data records:
https://developer.apple.com/documentation/coredata/synchronizing_a_local_store_to_the_cloud see CoreDataStack class
Topic:
Programming Languages
SubTopic:
Swift
Tags: