---
title: "addOrReplaceAttribute(_:)"
framework: modelio
role: symbol
role_heading: Instance Method
path: "modelio/mdlvertexdescriptor/addorreplaceattribute(_:)"
---

# addOrReplaceAttribute(_:)

Adds the specified vertex attribute to the vertex descriptor, replacing any existing attribute with the same name.

## Declaration

```swift
func addOrReplaceAttribute(_ attribute: MDLVertexAttribute)
```

## Parameters

- `attribute`: The vertex attribute to add to the vertex descriptor.

## Discussion

Discussion If the vertex descriptor contains an attribute whose name property is the same as that of the attribute parameter, the new attribute replaces the existing attribute in the attributes array. Otherwise, this method adds the new attribute to the end of the attributes array.

## See Also

### Working with Vertex Attributes

- [attributes](modelio/mdlvertexdescriptor/attributes.md)
- [attributeNamed(_:)](modelio/mdlvertexdescriptor/attributenamed(_:).md)
- [setPackedOffsets()](modelio/mdlvertexdescriptor/setpackedoffsets().md)
