<!--
{
  "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/init(arrayLiteral:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:Sa12arrayLiteralSayxGxd_tcfc"
  },
  "title" : "init(arrayLiteral:)"
}
-->

# init(arrayLiteral:)

Creates an array from the given array literal.

```
init(arrayLiteral elements: Element...)
```

## Parameters

`elements`

A variadic list of elements of the new array.

## Discussion

Do not call this initializer directly. It is used by the compiler
when you use an array literal. Instead, create a new array by using an
array literal as its value. To do this, enclose a comma-separated list of
values in square brackets.

Here, an array of strings is created from an array literal holding
only strings.

```
let ingredients = ["cocoa beans", "sugar", "cocoa butter", "salt"]
```

---

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)