protocol EntityCollection : Collection where Self.Element == Entity, Self.Index == Int
An ordered, mutable collection of entities.
Members (7)
method · iOS 18.0+
replaceAll
Swift declaration
mutating func replaceAll<S>(_ entities: S) where S : Sequence, S.Element : Entity
Replaces all entities in this collection with those from the given
sequence.
- Parameters:
- entities: The sequence of entities that will replace
the collection's current contents.
> Note: This operation might not maintain the new entities' index order.
method · iOS 18.0+
append
Swift declaration
mutating func append<S>(contentsOf sequence: S) where S : Sequence, S.Element : Entity
Adds the specified sequence of entities to the end of this collection,
in order.
- Parameters:
- sequence: The entities to add to the collection.
> Note: This operation can invalidate the index order of any extant entities.
method · iOS 18.0+
append
Swift declaration
mutating func append(_ entity: Entity)
Adds the specified entity to the end of this collection.
- Parameters:
- entity: The entity to add to the collection.
> Note: This operation can invalidate the index order of any extant entities.
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.
- Parameters:
- entity: The entity to add to the collection.
- index: The index of an entity to insert in front
of. If `endIndex` is provided, the entity
will be appended.
> Note: This operation can invalidate the index order of any extant entities.
method · iOS 18.0+
remove
Swift declaration
mutating func remove(_ entity: Entity)
Removes the entity from the collection.
- Parameters:
- entity: The entity to remove from the collection.
> Note: This operation can invalidate the index order of any remaining entities.
Removes all entities from this collection that satisfy the given predicate.
> Note: This operation can invalidate the index order of any remaining entities.