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

# update(from:)

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

## Declaration

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

## Parameters

- `source`: A sequence of elements to be used to update the contents of the buffer slice.

## Return Value

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

## Discussion

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