• 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
NSObject's inverseForRelationshipKey: behavior
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSObject's inverseForRelationshipKey: behavior


  • Subject: NSObject's inverseForRelationshipKey: behavior
  • From: Tim Hart <email@hidden>
  • Date: Thu, 26 Jan 2006 17:14:54 -0600

The documentation for NSClassDescription doesn't state what subclasses should do in this case:

Suppose a class Parent has a one to many relationship with the class Child.

@interface Parent
{
	NSSet *children;
}

@end

Also suppose that the class Child has two separate associations with Parent. One for Mom and one for Dad.
@interface Child
{
Parent *mom;
Parent *dad;
}


@end;

Outside of computers and OO, this is perfectly reasonable. A parent may have many children. Biologically a child has exactly 2 parents (living or dead), legally, a child has at most 2 parents.

What is 'inverseForRelationshipKey:' supposed to return in this case?

[parent inverseForRelationshipKey:@"children"];

I realize I have several opportunities to change the model so that inverseRelationshipKey: will only have one choice (abstracting roles, etc). I'm not worried about opportunities to change the model. I'm implementing a concrete subclass of NSClassDescription and need to know if there is accepted behavior for this particular case.

Tim Hart

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: NSCursor Resize Cursor
  • Next by Date: Re: NSCursor Resize Cursor
  • Previous by thread: Re: -doSomethingTrivial: (was empty subject line)
  • Next by thread: Fairly newbie question on strings
  • Index(es):
    • Date
    • Thread