Re: Lazy Loading Archive
Re: Lazy Loading Archive
- Subject: Re: Lazy Loading Archive
- From: Graff <email@hidden>
- Date: Mon, 25 Aug 2008 18:27:21 -0400
On Aug 25, 2008, at 2:05 PM, Shawn Erickson wrote:
On Mon, Aug 25, 2008 at 6:56 AM, Graff <email@hidden> wrote:
I have a large class I'm archiving that I would like to lazy-load.
It's
basically a wrapper around a NSArray and what I'd like to do is
load some
instance variables but leave the array archived until a later time
in order
to save time and memory.
When I implement the NSCoding protocol methods initWithCoder: and
encodeWithCoder: is it a bad idea to de-archive the keys that I
need and
just retain the NSCoder object so that I can later de-archive the
NSArray?
Is there any problem keeping the NSCoder object around for long
periods of
time? Is there a better way of doing this?
Core Data ?
That seems to be a bit involved for just one class and a couple of
instances of that class. Is there another way do do this? I imagine
it must have been something that you were able to do before Core Data
was invented.
I'm basically just wrapping a NSArray into a class with some metadata
about the array. We're talking about a class with a couple of
NSStrings, an NSArray, a few integers and a small amount of methods.
Core Data is wonderful if you have a complex graph of relationships
but I don't want to complicate things that much.
If I have to hack it by archiving the array and the metadata
separately I will but I'd prefer a more elegant approach.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden