NSMutableObject from existing custom class

Posted by A.S. on Stack Overflow See other posts from Stack Overflow or by A.S.
Published on 2010-04-02T08:41:35Z Indexed on 2010/04/02 8:43 UTC
Read the original article Hit count: 380

Hello there. I have an existing class that has methods to deserialise from XML in my code. Now I need to create correct CoreData model from that class. It's objects will be created not only from CoreData storage but also by deserializing XML (somehow like

instance->title = [[NSString stringWithUTF8String: (const char *)subNode->children->content] retain;  

) without saving to CoreData, and sometimes I need to save it.
What is the correct steps to modify existing class to do that except of adding CoreData framework and making my class an NSManagedObject instead of NSObject?

Class sample:

@interface TSTSong : NSManagedObject<NTSerializableObject> {
    NSString        *identifier;
    NSString        *title;
    float           length;
    NSURL           *previewURL;
    NSString        *author;
    NSURL           *coverURL;
    NSString        *appStoreId;
    BOOL            isPurchased;
    NSURL           *bannerURL;
    NSDecimalNumber *priceValue;
    NSLocale        *priceLocale;
}

P.S. I'm noob, so I'f I'm doing smth. wrong - please let me know. Sorry for my english.

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about core-data