Lukas Petr
Lukas Petr

Reputation: 1552

Does Ensembles support the new UUID entity attribute type?

In iOS 11, a new attribute type was introduced for Core Data Entities: UUID. I'd like to use that type for storing my uniqueIdentifiers for Ensembles. Is it safe to do so? Can Ensembles handle syncing the UUID attributes?

enter image description here

Here's how I plan to provide unique identifiers to the delegate method using my identifier properties:

- (NSArray *)persistentStoreEnsemble:(CDEPersistentStoreEnsemble *)ensemble 
   globalIdentifiersForManagedObjects:(NSArray *)objects
{
   NSArray <UUID *> *uuidArray = [objects valueForKeyPath:@"uniqueIdentifier"];
   return [uuidArray valueForKeyPath:@"UUIDString"];
}

Upvotes: 0

Views: 117

Answers (1)

Drew McCormack
Drew McCormack

Reputation: 3592

I somehow missed this feature. I have nothing in Ensembles to handle this specially, so it may not work. I would expect the fix to be fairly straightforward if it doesn't work, so if you find it is not working, let me know, and I'll look into it.

The problem will probably be in the conversion to JSON. See JSONValueFromCoreDataValue and CoreDataValueFromJSONValue. You probably just need to add an extra branch in the if-else to handle UUID explicitly.

Upvotes: 1

Related Questions