<!--
{
  "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/Array/append(contentsOf:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:Sa6append10contentsOfyqd__n_t7ElementQyd__RszSTRd__lF"
  },
  "title" : "append(contentsOf:)"
}
-->

# append(contentsOf:)

Adds the elements of a sequence to the end of the array.

```
mutating func append<S>(contentsOf newElements: S) where Element == S.Element, S : Sequence
```

## Parameters

`newElements`

The elements to append to the array.

## Discussion

Use this method to append the elements of a sequence to the end of this
array. This example appends the elements of a `Range<Int>` instance
to an array of integers.

```
var numbers = [1, 2, 3, 4, 5]
numbers.append(contentsOf: 10...15)
print(numbers)
// Prints "[1, 2, 3, 4, 5, 10, 11, 12, 13, 14, 15]"
```

> Complexity: O(*m*) on average, where *m* is the length of
> `newElements`, over many calls to `append(contentsOf:)` on the same
> array.

---

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)