iOS Developer Library — Pre-Release

Developer

Foundation Framework Reference NSMutableCopying Protocol Reference

Options
Deployment Target:

On This Page
Language:

NSMutableCopying

The NSMutableCopying protocol declares a method for providing mutable copies of an object. Only classes that define an “immutable vs. mutable” distinction should adopt this protocol. Classes that don’t define such a distinction should adopt NSCopying instead. More...

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Swift

import Foundation

Objective-C

@import Foundation;

Availability


Available in iOS 2.0 and later.
  • Returns a new instance that’s a mutable copy of the receiver. (required)

    Declaration

    Swift

    func mutableCopyWithZone(_ zone: NSZone) -> AnyObject?

    Objective-C

    - (id)mutableCopyWithZone:(NSZone *)zone

    Parameters

    zone

    The zone from which memory is allocated for the new instance. If zone is NULL, the new instance is allocated from the default zone, which is returned by NSDefaultMallocZone.

    Discussion

    The returned object is implicitly retained by the sender, which is responsible for releasing it. The copy returned is mutable whether the original is mutable or not.

    Import Statement

    Swift

    import Foundation

    Availability

    Available in iOS 2.0 and later.

    See Also

    – copyWithZone: (NSCopying protocol)
    – mutableCopy (NSObject class)