Initializes a newly allocated set and adds to it members of another given set.
- iOS 2.0+
- macOS 10.0+
- tvOS 9.0+
- watchOS 2.0+
A set containing objects to add to the new set.
true, 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 set.
false, then in a managed memory environment each object in
setsimply receives a
retainmessage when it is added to the returned set.
An initialized set that contains the members of
set. The returned set might be different than the original receiver.
After an immutable s has been initialized in this way, it cannot be modified.
copy(with:) method performs a shallow copy. If you have a collection of arbitrary depth, passing
true for the
flag parameter will perform an immutable copy of the first level below the surface. If you pass
false the mutability of the first level is unaffected. In either case, the mutability of all deeper levels is unaffected.