<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ModelIO",
  "identifier" : "/documentation/ModelIO/MDLVertexAttribute/init(name:format:offset:bufferIndex:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Model I/O"
    ],
    "preciseIdentifier" : "c:objc(cs)MDLVertexAttribute(im)initWithName:format:offset:bufferIndex:"
  },
  "title" : "init(name:format:offset:bufferIndex:)"
}
-->

# init(name:format:offset:bufferIndex:)

Initializes a vertex attribute object with the specified property values.

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

## Parameters

`name`

An identifier for the semantic use of the vertex attribute.

`format`

The format of per-vertex data for the attribute.

`offset`

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

`bufferIndex`

The index of the vertex buffer containing data for this attribute in a mesh’s [`vertexBuffers`](/documentation/ModelIO/MDLMesh/vertexBuffers) array.

## Return Value

A new vertex attribute object.

## Discussion

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

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)