Replaces the object at the index with the new object, possibly adding the object.
- iOS 6.0+
- macOS 10.8+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
The object with which to replace the object at index
indexin the array. This value must not be
The index of the object to be replaced. This value must not exceed the bounds of the array.
This method has the same behavior as the
index is beyond the end of the array (that is, if
index is greater than or equal to the value returned by
NSRange is raised.
You shouldn’t need to call this method directly. Instead, this method is called when setting an object by index using subscripting.