---
title: "vertexAttributeData(forAttributeNamed:)"
framework: modelio
role: symbol
role_heading: Instance Method
path: "modelio/mdlmesh/vertexattributedata(forattributenamed:)"
---

# vertexAttributeData(forAttributeNamed:)

Returns the vertex data for the specified attribute.

## Declaration

```swift
func vertexAttributeData(forAttributeNamed name: String) -> MDLVertexAttributeData?
```

## Parameters

- `name`: The attribute name for which to retrieve data. See Vertex Attributes for standard attribute names.

## Return Value

Return Value The vertex data for the specified attribute, or nil if the mesh does not contain vertex data for the specified attribute.

## Discussion

Discussion Calling this data is equivalent to using the mesh’s vertexDescriptor object to find the index of the MDLMeshBuffer object corresponding to the specified vertex attribute in the mesh’s vertexBuffers array, then using the vertex buffer’s map() method to gain read-only access to the vertex buffer’s data. important: The buffer’s storage remains mapped for as long as the returned MDLVertexAttributeData object exists, potentially restricting other uses of that storage. For example, if a buffer’s storage is shared with GPU memory, that buffer may be unavailable for use in rendering until the data object is deallocated.

## See Also

### Working with Vertex Data

- [boundingBox](modelio/mdlmesh/boundingbox.md)
- [submeshes](modelio/mdlmesh/submeshes.md)
- [vertexBuffers](modelio/mdlmesh/vertexbuffers.md)
- [vertexCount](modelio/mdlmesh/vertexcount.md)
- [vertexDescriptor](modelio/mdlmesh/vertexdescriptor.md)
- [allocator](modelio/mdlmesh/allocator.md)
- [addAttribute(withName:format:)](modelio/mdlmesh/addattribute(withname:format:).md)
- [addAttribute(withName:format:type:data:stride:)](modelio/mdlmesh/addattribute(withname:format:type:data:stride:).md)
- [addAttribute(withName:format:type:data:stride:time:)](modelio/mdlmesh/addattribute(withname:format:type:data:stride:time:).md)
- [removeAttributeNamed(_:)](modelio/mdlmesh/removeattributenamed(_:).md)
- [replaceAttributeNamed(_:with:)](modelio/mdlmesh/replaceattributenamed(_:with:).md)
- [updateAttributeNamed(_:with:)](modelio/mdlmesh/updateattributenamed(_:with:).md)
- [addUnwrappedTextureCoordinates(forAttributeNamed:)](modelio/mdlmesh/addunwrappedtexturecoordinates(forattributenamed:).md)
- [vertexAttributeData(forAttributeNamed:as:)](modelio/mdlmesh/vertexattributedata(forattributenamed:as:).md)
