Replaces the existing anchor collection with a provided collection.
This method removes all anchors currently in the collection, then
appends all the elements in `entities` to the collection.
- Parameters:
- entities: An array of anchors to replace the existing collection.
Returns an iterator over the elements of the collection.
method · iOS 13.0+
index
TypeScript
index(i: number): Promise<number>
Swift declaration
@MainActor @preconcurrency func index(after i: Int) -> Int
Returns the position immediately after the given index.
- Parameters:
- i: A valid index of the collection. Use a value less than ``endIndex``.
- Returns: The index value immediately after i.
Removes and returns the anchor at the specified position.
- Parameters:
- index: The position of the anchor to remove.
Use a valid index of the collection.
method · iOS 13.0+
remove
TypeScript
remove(entity: SDKHandle): Promise<void>
Swift declaration
@MainActor @preconcurrency func remove(_ entity: any HasAnchoring)
Removes the anchor at the specified position.
- Parameters:
- entity: The anchor to remove from the collection.
get · iOS 13.0+
endIndex
TypeScript
get endIndex(): Promise<number>
Swift declaration
@MainActor @preconcurrency var endIndex: Int { get }
The position one greater than the last valid subscript argument.
When you need a range that includes the last element of an array,
use the half-open range operator (`..<`) with
``Scene/AnchorCollection/endIndex``. The `..<` operator creates a
range that doesn’t include the upper bound, so it’s safe to
use with ``Scene/AnchorCollection/endIndex``.
If the array is empty, ``Scene/AnchorCollection/endIndex`` is equal
to ``Scene/AnchorCollection/startIndex``.
Removes all anchors from the collection.
- Parameters:
- keepCapacity: Pass true to keep the existing capacity of the array
after removing its elements. The default value is false.
method · iOS 13.0+
removeAll
TypeScript
removeAll(): Promise<void>
Swift declaration
@MainActor @preconcurrency func removeAll()
Removes all anchors from the collection.
subscript · iOS 13.0+
subscript
TypeScript
subscript(index: number): Promise<SDKHandle>
Swift declaration
@MainActor @preconcurrency subscript(index: Int) -> any HasAnchoring { get set }