Initializes a newly allocated array using
an as the source of data objects for the array.
- iOS 2.0+
- macOS 10.2+
- tvOS 9.0+
- watchOS 2.0+
An array containing the objects with which to initialize the new array.
YES, each object in
copymessage to create a copy of the object—objects must conform to the
NSCopyingprotocol. In a managed memory environment, this is instead of the
retainmessage the object would otherwise receive. The object copy is then added to the returned array.
NO, then in a managed memory environment each object in
arraysimply receives a
retainmessage when it is added to the returned array.
An array initialized to contain the objects—or if
YES, copies of the objects—in
array. The returned object might be different than the original receiver.
After an immutable array has been initialized in this way, it cannot be modified.
copy method performs a shallow copy. If you have a collection of arbitrary depth, passing
YES for the
flag parameter will perform an immutable copy of the first level below the surface. If you pass
NO the mutability of the first level is unaffected. In either case, the mutability of all deeper levels is unaffected.