<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/UnsafeMutableBufferPointer/update(from:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:Sr6update4from8IteratorQyd__9unwritten_Si5indextqd___t7ElementQyd__RszSTRd__lF"
  },
  "title" : "update(from:)"
}
-->

# update(from:)

Updates the buffer’s initialized memory with the given elements.

```
func update<S>(from source: S) -> (unwritten: S.Iterator, index: UnsafeMutableBufferPointer<Element>.Index) where Element == S.Element, S : Sequence
```

## Parameters

`source`

A sequence of elements to be used to update
the buffer’s contents.

## Return Value

An iterator to any elements of `source` that didn’t fit in the
buffer, and the index one past the last updated element in the buffer.

## Discussion

The buffer’s memory must be initialized or its `Element` type
must be a trivial type.

---

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)