<!--
{
  "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/Slice/update(from:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:s5SliceV6update4from8IteratorQyd__9unwritten_Si5indextqd___tSry7ElementQyd__GRszSTRd__lF"
  },
  "title" : "update(from:)"
}
-->

# update(from:)

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

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

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

The buffer slice’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)