• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Core data accessors for structs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Core data accessors for structs


  • Subject: Core data accessors for structs
  • From: MH <email@hidden>
  • Date: Mon, 25 Jun 2007 14:38:05 +0100

Hi Folks,

I've been looking at:

http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdNSAttributes.html

Although this seems to work fine. Are there any other issues that I'm
overlooking?
Also, I'm concerned that I loose KVC compliance using these kinds of
accessors.
Is there a way to restore KVC in this situtation?


- (myStruct)foo { [self willAccessValueForKey:@"foo"]; myStruct bar = foo; [self didAccessValueForKey:@"foo"];

    NSData *fooAsData = [self valueForKey:@"foo"];

       if (structAsData != nil) {

           [structAsData getBytes:&bar length:sizeof(myStruct)];
       }

   return bar;
}

- (void)setFoo:(myStruct)newFoo
{
   [self willChangeValueForKey:@"foo"];
   foo = newFoo;
   [self didChangeValueForKey:@"foo"];

   NSData *fooAsData = [NSData dataWithBytes:&newFoo
length:sizeof(myStruct)];

   [self setValue:fooAsData forKey:@"foo"];
}

Many thanks.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Core data accessors for structs
      • From: Jim Correia <email@hidden>
    • Re: Core data accessors for structs
      • From: Charles Steinman <email@hidden>
  • Prev by Date: NSTextView contained in a bezier-path
  • Next by Date: Re: ObjC 3D engine
  • Previous by thread: [SOLVED] NSTextView contained in a bezier-path
  • Next by thread: Re: Core data accessors for structs
  • Index(es):
    • Date
    • Thread