Well, yes, that's a good question.
But I spent a good deal of time trying to find a way around it and couldn't.
However, in the meantime I discovered that by using a home-spun -deepCopy
method on just a couple of classes I was able to solve my mutation problem,
without resorting to the wholesal
On 15 Feb 2013, at 01:25, Ken Thomases wrote:
>
>
> On Feb 14, 2013, at 8:30 AM, Uli Kusterer wrote:
>
>> On Feb 14, 2013, at 3:57 AM, Ken Thomases wrote:
>>> Your question prompted me to try to design an analog of NSKeyedArchiver,
>>> NSCode, and NSCoding that would generate the new objec
On 14/02/2013, at 1:07 PM, James Maxwell wrote:
> I've run into a situation where I really need a deep copy of an object.
My question would be: are you really sure?
Yes, there are times you need a deep copy, but surprisingly few. Often you can
redesign your code not to need one
--Graha
I've taken the plunge and written a mutable deep copy method for NSObject in my
applications.
So far, I've used it only to add interesting arbitrary objects to NSError
userInfo dictionaries. Unliike Ken and Uli, I'd never thought about the
circular references in object trees, but I ran into a
On Feb 14, 2013, at 8:30 AM, Uli Kusterer wrote:
> On Feb 14, 2013, at 3:57 AM, Ken Thomases wrote:
>> Your question prompted me to try to design an analog of NSKeyedArchiver,
>> NSCode, and NSCoding that would generate the new object graph on the fly as
>> it went instead of producing a data o
On 14 Feb 2013, at 02:07, James Maxwell wrote:
> I've run into a situation where I really need a deep copy of an object. I've
> implemented this using Apple's recommended approach with
> NSKeyedArchiver/Unarchiver, and it's nice, simple, and functional. But it's
> also pretty darn slow -- as
What NSKeyedArchiver probably does is have a dictionary that maps the original
object pointer values to the copied objects. So instead of just straight-out
copying an object, it does:
NSString* theKey = [NSString stringWithFormat: @"%p", theOriginal];
id theCopy = [objectCopies objectForKey: the
I wrote a -deepCopy method as part of a protocol on the common collection
classes. It does a respondsToSelector: and calls -copy if it doesn't. So as
long as my collection views cover all collection classes to create a new
NSArray etc. containing copies of the same objects, it mostly works. Down
On Feb 13, 2013, at 8:07 PM, James Maxwell wrote:
> I've run into a situation where I really need a deep copy of an object. I've
> implemented this using Apple's recommended approach with
> NSKeyedArchiver/Unarchiver, and it's nice, simple, and functional. But it's
> also pretty darn slow -- as
I've run into a situation where I really need a deep copy of an object. I've
implemented this using Apple's recommended approach with
NSKeyedArchiver/Unarchiver, and it's nice, simple, and functional. But it's
also pretty darn slow -- as in a clear, subjectively apparent performance hit.
Has any
10 matches
Mail list logo