Initializes a vertex attribute object with the specified property values.


init(name: String, format: MDLVertexFormat, offset: Int, bufferIndex: Int)



An identifier for the semantic use of the vertex attribute.


The format of per-vertex data for the attribute.


The offset, in bytes, of vertex data for the attribute in a vertex buffer, relative to the start of data for each vertex.


The index of the vertex buffer containing data for this attribute in a mesh’s vertexBuffers array.

Return Value

A new vertex attribute object.


Use this initializer when constructing a new mesh from custom data, or when building a new MDLVertexDescriptor object to change the vertex buffer formatting of an existing mesh. When you load a mesh from a MDLAsset object, Model I/O automatically creates vertex descriptor and vertex attribute objects describing the mesh’s vertex data.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software