Initializer

init()

Creates a new, empty array.

Declaration

init()

Discussion

This is equivalent to initializing with an empty array literal. For example:

var emptyArray = Array<Int>()
print(emptyArray.isEmpty)
// Prints "true"

emptyArray = []
print(emptyArray.isEmpty)
// Prints "true"

Relationships

See Also

Creating an Array

init<S>(S)

Creates a new instance of a collection containing the elements of a sequence.

init<S>(S)

Creates an array containing the elements of a sequence.

init(repeating: Element, count: Int)

Creates a new array containing the specified number of a single, repeated value.