How to set up a has-many relationship in Cocoa?
Posted
by SphereCat1
on Stack Overflow
See other posts from Stack Overflow
or by SphereCat1
Published on 2010-05-16T14:35:10Z
Indexed on
2010/05/16
14:40 UTC
Read the original article
Hit count: 261
I'm building a (very) simple FTP app in Cocoa, and I need to store information on the different types of servers that are supported. So, I've created a ServerType class, which stores all of the relevant information about a single type of server. I then have a ServerTypes class which is designed to manage all of the ServerType classes that are created.
My question is how to set up the relationship between the two objects. Is there a preferred method to do so?
Also, since Objective-C doesn't support non-instance classes, where should I create an instance of ServerTypes that will have to be used throughout the entire program? Or is there a better way to do that? I need it to be KVC compliant so That I can bind one of the ServerType properties to an NSPopupBox.
Sorry about the large volume of questions, I'm fairly new to Cocoa and Objective-C. If you need to see code, just ask and I'll be happy to add some. :)
SphereCat1
© Stack Overflow or respective owner