Swift – Create a Set from Array Literal
To create a Set from the values of an Array literal in Swift, declare a Set variable and initialize it with Array literal.
The syntax to create a Set
x from an Array literal is
var x: Set = [value1, value2]
In the following program, we will create a Set from an array of integers.
var x: Set = [25, 4, 9] print(x)
In this Swift Tutorial, we have learned how to create a Set from Array literal, in Swift programming.