mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-11 20:00:30 +01:00
What is the role of UniqueIdValue. #108
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ghost on GitHub (Nov 29, 2016).
I just implemented the ImportableUniqueObject protocol and its working just fine. Any 'Person' which has the same 'name' is not duplicated. However, 'uniqueIDValue' does not seem to be playing a role in all this, so I'm wondering what its purpose is. In its return value, you can see that I put some random string as it didn't matter what was there, everything works fine. Here is the code I have for it.
import Foundation
import CoreData
import CoreStore
@objc(Person)
public class Person: NSManagedObject, ImportableUniqueObject {
}
@JohnEstropia commented on GitHub (Nov 29, 2016):
@rslim087g You can check how
uniqueIDValueis used here: https://github.com/JohnEstropia/CoreStore/blob/swift3_develop/Sources/Importing/BaseDataTransaction%2BImporting.swift#L227If you assign a random string like in your code, you will never map your source properly to its ID (in this case,
source["name"]@ghost commented on GitHub (Nov 29, 2016):
Thank you for both the library and the response ! Clear as day.