---
title: "init(object:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/nsarray/init(object:)"
---

# init(object:)

Creates and returns an array containing a given object.

## Declaration

```swift
convenience init(object anObject: Any)
```

## Parameters

- `anObject`: An object.

## Return Value

Return Value An array containing the single element anObject.

## Discussion

Discussion Alternatively, you can use array literal syntax in Objective-C or Swift to create an array containing a given object:

## See Also

### Creating an Array

- [init(objects:count:)](foundation/nsarray/init(objects:count:)-7dct1.md)
