I have a managed object with a transformable attribute. The attribute is a C struct and uses a custom value transformer. The transformer uses the depreciated NSArchiver but it is drop dead simple and it works.

I am trying to implement keyed archiving and can't figure out what to do or which way to go. I can't seem to see the forest for the trees and keep going around in circles in the documentation and on the web.

The C struct "Foo" is defined like this.

     typedef struct { double a; double b; double c; double d; } Bar;

     typedef struct { Bar e; Bar f; } Foo;

The current custom value transformer.

     @interface MyArchiveToDataTransformer : NSValueTransformer
     @end

     @implementation MyArchiveToDataTransformer
     + (Class)transformedValueClass
     {
          return [NSData class];
     }
     + (BOOL)allowsReverseTransformation
     {
          return YES;
     }
          - (id)transformedValue:(id)value
     {
          return [NSArchiver archivedDataWithRootObject:value];
     }
     - (id)reverseTransformedValue:(id)data
     {
          return [NSUnarchiver unarchiveObjectWithData:data];
     }
     @end

Any suggestions or insight for the lost and confused?

--Richard

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to