Instance Method

removeObject(at:)

Removes the object at index .

Declaration

func removeObject(at index: Int)

Parameters

index

The index from which to remove the object in the array. The value must not exceed the bounds of the array.

Discussion

To fill the gap, all elements beyond index are moved by subtracting 1 from their index.

See Also

Removing Objects

func removeAllObjects()

Empties the array of all its elements.

func removeLastObject()

Removes the object with the highest-valued index in the array

func remove(Any)

Removes all occurrences in the array of a given object.

func remove(Any, in: NSRange)

Removes all occurrences within a specified range in the array of a given object.

func removeObjects(at: IndexSet)

Removes the objects at the specified indexes from the array.

func removeObject(identicalTo: Any)

Removes all occurrences of a given object in the array.

func removeObject(identicalTo: Any, in: NSRange)

Removes all occurrences of anObject within the specified range in the array.

func removeObjects(fromIndices: UnsafeMutablePointer<Int>, numIndices: Int)

Removes the specified number of objects from the array, beginning at the specified index.

Deprecated
func removeObjects(in: [Any])

Removes from the receiving array the objects in another given array.

func removeObjects(in: NSRange)

Removes from the array each of the objects within a given range.

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