iosmetalnscopying

Mantle MTLModel's copyWithZone: deep copy?


Suppose we have a subclass of MTLModel,and the class immediately obtains copyWithZone:'s implementation.But I want to know the framework did it using deep copy or not.For example,if the class has array or object properties,are they copied with reference or newly allocated object.Many thanks.


Solution

  • Mantle is open source; you can answer these sorts of questions yourself by reading the code. From my reading, no, it does not perform a deep copy, as it relies on the copy behavior of the properties being copied. So if you have an NSArray property, it will be copied like any other NSArray, which is not deeply.