---
title: "newBuffer(from:data:type:)"
framework: modelio
role: symbol
role_heading: Instance Method
path: "modelio/mdlmeshbufferallocator/newbuffer(from:data:type:)"
---

# newBuffer(from:data:type:)

Creates a new buffer containing the specified data in the specified zone.

## Declaration

```swift
func newBuffer(from zone: (any MDLMeshBufferZone)?, data: Data, type: MDLMeshBufferType) -> (any MDLMeshBuffer)?
```

## Parameters

- `zone`: A pool of memory for related allocations, as returned by the doc://com.apple.modelio/documentation/ModelIO/MDLMeshBufferAllocator/newZone(_:) method.
- `data`: The initial data to store in the buffer. Implementations of this protocol typically copy this data.
- `type`: Use 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.

## Return Value

Return Value A new memory buffer for mesh data.

## Discussion

Discussion Use this method when making multiple related allocations that should share the same memory pool.

## See Also

### Allocating Mesh Buffers

- [newZone(_:)](modelio/mdlmeshbufferallocator/newzone(_:).md)
- [newZoneForBuffers(withSize:andType:)](modelio/mdlmeshbufferallocator/newzoneforbuffers(withsize:andtype:).md)
- [newBuffer(_:type:)](modelio/mdlmeshbufferallocator/newbuffer(_:type:).md)
- [newBuffer(from:length:type:)](modelio/mdlmeshbufferallocator/newbuffer(from:length:type:).md)
- [newBuffer(with:type:)](modelio/mdlmeshbufferallocator/newbuffer(with:type:).md)
