Replaces the object at index
with an
.
SDKs
- iOS 2.0+
- macOS 10.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
Framework
- Foundation
Declaration
func replaceObject(at index: Int, with anObject: Any)
Parameters
index
The index of the object to be replaced. This value must not exceed the bounds of the array.
Important
Raises an
NSRange
ifException index
is beyond the end of the array.anObject
The object with which to replace the object at index
index
in the array. This value must not benil
.Important
Raises an
NSInvalid
ifArgument Exception an
isObject nil
.