One Logo Pool Ball
RealityFoundation · IOS API REFERENCE

MeshInstanceCollection

struct · iOS 15.0+ · SDK 27.1

struct MeshInstanceCollection

An object that holds a collection of mesh resource instances.

Members (15)

get · iOS 18.0+

startIndex

TypeScript
get startIndex(): number
Swift declaration
var startIndex: Int { get }

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

method · iOS 15.0+

makeIterator

TypeScript
makeIterator(): MeshInstanceCollection_Iterator
Swift declaration
func makeIterator() -> MeshInstanceCollection.Iterator

Returns an iterator over the elements of this sequence.

get · iOS 15.0+

count

TypeScript
get count(): number
Swift declaration
var count: Int { get }

Number of instances.

method · iOS 18.0+

index

TypeScript
index(i: number): number
Swift declaration
func index(after i: Int) -> Int

Returns the position immediately after the given index. The successor of an index must be well defined. For an index `i` into a collection `c`, calling `c.index(after: i)` returns the same index every time. - Parameter i: A valid index of the collection. `i` must be less than `endIndex`. - Returns: The index value immediately after `i`.

method · iOS 15.0+

insert

TypeScript
insert(instance: MeshResource_Instance): boolean
Swift declaration
@discardableResult mutating func insert(_ instance: MeshResource.Instance) -> Bool

Add a new instance to the container. Returns true if added. Returns false if it already exists.

method · iOS 15.0+

remove

TypeScript
remove(id: string): (MeshResource_Instance) | null
Swift declaration
@discardableResult mutating func remove(id: String) -> MeshResource.Instance?

Remove an instance by name.

method · iOS 15.0+

update

TypeScript
update(instance: MeshResource_Instance): (MeshResource_Instance) | null
Swift declaration
@discardableResult mutating func update(_ instance: MeshResource.Instance) -> MeshResource.Instance?

Update an existing instance. The old instance is returned.

get · iOS 15.0+

isEmpty

TypeScript
get isEmpty(): boolean
Swift declaration
var isEmpty: Bool { get }

True if there are no instances.

get · iOS 18.0+

endIndex

TypeScript
get endIndex(): number
Swift declaration
var endIndex: Int { get }

The collection's "past the end" position---that is, the position one greater than the last valid subscript argument. When you need a range that includes the last element of a collection, use the half-open range operator (`..<`) with `endIndex`. The `..<` operator creates a range that doesn't include the upper bound, so it's always safe to use with `endIndex`. For example: let numbers = [10, 20, 30, 40, 50] if let index = numbers.firstIndex(of: 30) { print(numbers[index ..< numbers.endIndex]) } // Prints "[30, 40, 50]" If the collection is empty, `endIndex` is equal to `startIndex`.

method · iOS 18.0+

formIndex

TypeScript
formIndex(i: number): { $ret: null; $out: { "i": number } }
Swift declaration
func formIndex(after i: inout Int)

Replaces the given index with its successor. - Parameter i: A valid index of the collection. `i` must be less than `endIndex`.

Omit the output parameters from the call. The result contains $ret and $out, with i inside $out.

method · iOS 15.0+

removeAll

TypeScript
removeAll(): void
Swift declaration
mutating func removeAll()

Remove all the instances.

init · iOS 15.0+

init

TypeScript
static init(): MeshInstanceCollection
Swift declaration
init()
subscript · iOS 15.0+

subscript

TypeScript
subscript(id: string): (MeshResource_Instance) | null
Swift declaration
subscript(id: String) -> MeshResource.Instance? { get }

Read an instance given its name.

subscript · iOS 18.0+

subscript

TypeScript
subscript50106(position: number): MeshResource_Instance
Swift declaration
subscript(position: Int) -> MeshResource.Instance { get }

Accesses the element at the specified position. The following example accesses an element of an array through its subscript to print its value: var streets = ["Adams", "Bryant", "Channing", "Douglas", "Evarts"] print(streets[1]) // Prints "Bryant" You can subscript a collection with any valid index other than the collection's end index. The end index refers to the position one past the last element of a collection, so it doesn't correspond with an element. - Parameter position: The position of the element to access. `position` must be a valid index of the collection that is not equal to the `endIndex` property. - Complexity: O(1)

init · iOS 15.0+

init

TypeScript
static init17600(instances: Array<MeshResource_Instance>): MeshInstanceCollection
Swift declaration
init(_ instances: [MeshResource.Instance])

Skipped declarations

1 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

MeshInstanceCollection.init(arrayLiteral:)

A variable number of Swift arguments is not supported.

All RealityFoundation types →