Instance Method

replaceObject(at:with:)

Replaces the object at index with anObject.

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.

anObject

The object with which to replace the object at index index in the array. This value must not be nil.

See Also

Replacing Objects

func replaceObjects(at: IndexSet, with: [Any])

Replaces the objects in the receiving array at locations specified with the objects from a given array.

func replaceObjects(in: NSRange, withObjectsFrom: [Any], range: NSRange)

Replaces the objects in the receiving array specified by one given range with the objects in another array specified by another range.

func replaceObjects(in: NSRange, withObjectsFrom: [Any])

Replaces the objects in the receiving array specified by a given range with all of the objects from a given array.

func setArray([Any])

Sets the receiving array’s elements to those in another given array.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software