<!--
{
  "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/moveUpdate(fromContentsOf:)-5i98g",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:s5SliceV10moveUpdate14fromContentsOfSiSryqd__G_tAERszlF"
  },
  "title" : "moveUpdate(fromContentsOf:)"
}
-->

# moveUpdate(fromContentsOf:)

Updates this buffer slice’s initialized memory by
moving every element from the source buffer,
leaving the source memory uninitialized.

```
func moveUpdate<Element>(fromContentsOf source: UnsafeMutableBufferPointer<Element>) -> Slice<Base>.Index where Base == UnsafeMutableBufferPointer<Element>
```

## Parameters

`source`

A buffer containing the values to move.
The memory region underlying `source` must be initialized.

## Return Value

An index one past the index of the last element updated.

## Discussion

The region of memory starting at the beginning of this buffer slice and
covering `source.count` instances of its `Element` type  must be
initialized, or its `Element` type must be a trivial type.
After calling `moveUpdate(fromContentsOf:)`,
the region of memory underlying `source` is uninitialized.
The buffer slice must reference enough initialized memory
to accommodate `source.count` elements.

The returned index is one past the index of the last element updated.
If `source` contains no elements, the returned index is equal to the
buffer’s `startIndex`. If `source` contains as many elements as the buffer
slice can hold, the returned index is equal to the slice’s `endIndex`.

> Note: The memory regions referenced by `source` and this buffer slice
> must not overlap.

> Precondition: `self.count` >= `source.count`

---

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)