<!--
{
  "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/MDLMeshBuffer/fill(_:offset:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Model I/O"
    ],
    "preciseIdentifier" : "c:objc(pl)MDLMeshBuffer(im)fillData:offset:"
  },
  "title" : "fill(_:offset:)"
}
-->

# fill(_:offset:)

Writes the specified data into the buffer.

```
func fill(_ data: Data, offset: Int)
```

## Parameters

`data`

The data to be copied into the buffer.

`offset`

The offset, in bytes, from the start of the buffer at which to write data.

## Discussion

If the length of the specified data (plus the `offset` parameter, if nonzero) is greater than the buffer’s [`length`](/documentation/ModelIO/MDLMeshBuffer/length) property, this method writes data only up to the end of the buffer.

---

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)