---
title: "init(type:data:)"
framework: modelio
role: symbol
role_heading: Initializer
path: "modelio/mdlmeshbufferdata/init(type:data:)"
---

# init(type:data:)

Initializes a buffer containing the specified data.

## Declaration

```swift
init(type: MDLMeshBufferType, data: Data?)
```

## Parameters

- `type`: doc://com.apple.modelio/documentation/ModelIO/MDLMeshBufferType/vertex to create a buffer for a mesh’s vertex attribute data, or doc://com.apple.modelio/documentation/ModelIO/MDLMeshBufferType/index to create a buffer for a submesh’s index data.
- `data`: The initial data to copy into the buffer.

## Return Value

Return Value A new memory buffer for mesh data.

## See Also

### Creating a Buffer

- [init(type:length:)](modelio/mdlmeshbufferdata/init(type:length:).md)
