Returns a new instance that’s a copy of the receiver.
Required.
SDKs
- iOS 2.0+
- macOS 10.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
Framework
- Foundation
Declaration
- (id)copyWithZone:(NSZone *)zone;
Parameters
zone
This parameter is ignored. Memory zones are no longer used by Objective-C.
Discussion
The returned object is implicitly retained by the sender, who is responsible for releasing it. The copy returned is immutable if the consideration “immutable vs. mutable” applies to the receiving object; otherwise the exact nature of the copy is determined by the class.