Inserts the elements of a sequence into the collection at the specified position.
- iOS 7.0+
- macOS 10.9+
- tvOS 9.0+
- watchOS 2.0+
- Xcode 10.2+
The new elements to insert into the collection.
The position at which to insert the new elements.
indexmust be a valid index of the collection.
The new elements are inserted before the element currently at the specified index. If you pass the collection’s
end property as the
index parameter, the new elements are appended to the collection.
Here’s an example of inserting a range of integers into an array of the same type:
Calling this method may invalidate any existing indices for use with this collection.
Complexity: O(n + m), where n is length of this collection and m is the length of
i == end, this method is equivalent to