---
title: "update(from:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/unsafemutablebufferpointer/update(from:)"
---

# update(from:)

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

## Declaration

```swift
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

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

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