Contents

insert(_:at:)

Inserts the given object at the specified index of the mutable ordered set, if it is not already a member.

Declaration

func insert(_ object: Any, at idx: Int)

Parameters

  • object:

    The object to insert into the set’s content.

  • idx:

    The index in the mutable ordered set at which to insert object. This value must not be greater than the count of elements in the array.

Discussion

If the object is already a member, this method has no effect. If the specified index is already occupied, the objects at that index and beyond are shifted by adding 1 to their indexes to make room for the inserted object.

See Also

Adding, Removing, and Reordering Entries