insert(_:beforeIndex:)
Adds the specified entity to this collection directly before the entity at the given index. If the entity is already located before the index, the collection will not change.
Declaration
mutating func insert(_ entity: Entity, beforeIndex index: Int)Parameters
- entity:
The entity to add to the collection.
- index:
The index of an entity to insert in front of. If
endIndexis provided, the entity will be appended.