One Logo Pool Ball
RealityFoundation · IOS API REFERENCE

Scene.AnchorCollection

struct · iOS 13.0+ · SDK 27.1

@MainActor @preconcurrency struct AnchorCollection

A collection of anchor entities.

Members (15)

method · iOS 13.0+

replaceAll

TypeScript
replaceAll(entities: Array<SDKHandle>): Promise<void>
Swift declaration
@MainActor @preconcurrency func replaceAll(_ entities: [any HasAnchoring])

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.

method · iOS 13.0+

replaceAll

TypeScript
replaceAll84303(entities: Array<AnchorEntity>): Promise<void>
Swift declaration
@MainActor @preconcurrency func replaceAll<S>(_ entities: S) where S : Sequence, S.Element : HasAnchoring

Replaces the existing anchor collection with a provided sequence. - Parameters: - entities: A sequence of anchors to replace the existing collection.

get · iOS 13.0+

startIndex

TypeScript
get startIndex(): Promise<number>
Swift declaration
@MainActor @preconcurrency var startIndex: Int { get }

The position of the first element in a nonempty collection. If the collection is empty, `startIndex` is equal to `endIndex`.

get · iOS 13.0+

description

TypeScript
get description(): Promise<string>
Swift declaration
@MainActor @preconcurrency var description: String { get }

A textual representation of this instance.

method · iOS 13.0+

makeIterator

TypeScript
makeIterator(): Promise<Entity_ChildCollection_IndexingIterator<Scene_AnchorCollection>>
Swift declaration
@MainActor @preconcurrency func makeIterator() -> Scene.AnchorCollection.Iterator

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.

method · iOS 13.0+

append

TypeScript
appendContentsOf(array: Array<SDKHandle>): Promise<void>
Swift declaration
@MainActor @preconcurrency func append(contentsOf array: [any HasAnchoring])

Adds anchors from an array to the end of this collection. - Parameters: - array: The array of anchor entities to add.

method · iOS 13.0+

append

TypeScript
appendContentsOf19285(sequence: Array<AnchorEntity>): Promise<void>
Swift declaration
@MainActor @preconcurrency func append<S>(contentsOf sequence: S) where S : Sequence, S.Element : HasAnchoring

Adds anchors from a sequence to the end of this collection. - Parameters: - sequence: The sequence of anchor entities to add.

method · iOS 13.0+

append

TypeScript
append(entity: SDKHandle): Promise<void>
Swift declaration
@MainActor @preconcurrency func append(_ entity: any HasAnchoring)

Adds a new anchor at the end of the collection. - Parameters: - entity: The element to append to the collection.

method · iOS 13.0+

remove

TypeScript
removeAt(index: number): Promise<void>
Swift declaration
@MainActor @preconcurrency func remove(at index: Int)

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``.

method · iOS 13.0+

removeAll

TypeScript
removeAllKeepCapacity(keepCapacity?: boolean): Promise<void>
Swift declaration
@MainActor @preconcurrency func removeAll(keepCapacity: Bool = false)

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 }

Accesses the element at the specified position.

Skipped declarations

No declarations were skipped in this snapshot.

All RealityFoundation types →