Implementation help... Subclass NSManagedObject?
- by Canada Dev
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