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