<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/UniqueArray/insert(moving:at:)-4f2qc",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:s11UniqueArrayVsRi_zrlE6insert6moving2atySryxG_SitF"
  },
  "title" : "insert(moving:at:)"
}
-->

# insert(moving:at:)

Moves the elements of a fully initialized buffer into this array,
starting at the specified position, and leaving the buffer
uninitialized.

```
mutating func insert(moving items: UnsafeMutableBufferPointer<Element>, at index: Int)
```

## Parameters

`items`

A fully initialized buffer whose contents to move into
the array.

`index`

The index at which to move `items`.

## Discussion

If the array does not have sufficient capacity to hold all elements,
then this reallocates storage to extend its capacity, using a geometric
growth rate.

> Complexity: O(`self.count` + `items.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)