Implementation help... Subclass NSManagedObject?

Posted by Canada Dev on Stack Overflow See other posts from Stack Overflow or by Canada Dev
Published on 2010-06-18T02:10:30Z Indexed on 2010/06/18 4:33 UTC
Read the original article Hit count: 191

Filed under:
|
|

I'm working on an app where I have some products that I download in a list. The downloaded products are displayed in a table and each will is showing a detail view with more information.

These same products can be saved as a favorite, and for this I am using Core Data.

I'd like to be able to re-use a bunch of views for displaying the products, which means the stores object and the downloaded object would have to be the same kind.

Now, how would I go about best implementing the objects? Can I make a class such as this:

FavoriteProduct : NSManageObject // implementation

and then subclass

Product : FavoriteProduct // implementation

?

The CD class just doesn't give me everything. What would be the best way to merge these two object classes so I have as little work ahead of me in terms of implementing the different views for each object? Basically, I just want to be able to call the same methods, etc. on the Product objects as I would on the ones that are FavoriteProduct objects, and re-use views for both kinds. There's only a bit of difference between the two (one is of course stored as a favorite and has some extra values such as notes, tags, while the Product one doesn't).

Thanks in advance

© Stack Overflow or respective owner

Related posts about iphone

Related posts about core-data