Swift Set to Array

You can create an array with all elements from a given Swift
Set simply with

let array = Array(someSet)

This works because Set conforms to the SequenceType protocol
and an Array can be initialized with a sequence. Example:

let mySet = Set(["a", "b", "a"])  // Set<String>
let myArray = Array(mySet)        // Array<String>
print(myArray) // [b, a]

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)