Is there anything like a generic list in Cocoa / Objective-C? -
What I really like in C # General list is a list that can contain only one type of object cocoa / Objective-C is something like a generic list? As far as I know only NSArray , which will take an indicator on any object.
In this coco app, it often indicates a weak design.
NSArray is irreversible, so it will not "take any indicators on any object" and potentially you will meet with the right objects before I understand that you are as worried, It's a NSMutableArray , where you think other parts of your code may contain a wrong type of object but look at the coco itself;
Instead, you usually expose a NSArray and expose some methods to modify that array. Some on the lines of:
@class Foo: NSObject - (NSArray *) times; - (zero) AdBar: (bar *) bar; - Remove (zero) fence: (bar *) bar; @end This is usually done by the compiler warning that the wrong things are inserted, and then of course you can logic within -addBar: and You can add - Dump: if you want too.
Comments
Post a Comment