Initializer

init()

Creates an empty set.

Declaration

init()

Discussion

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

var emptySet = Set<Int>()
print(emptySet.isEmpty)
// Prints "true"

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

Relationships

From Protocol

See Also

Creating a Set

init(minimumCapacity: Int)

Creates an empty set with preallocated space for at least the specified number of elements.

init<S>(S)

Creates a new set from a finite sequence of items.

init<Source>(Source)

Creates a new set from a finite sequence of items.