Looking for swift Answers? Try Ask4KnowledgeBase
Looking for swift Keywords? Try Ask4Keywords

Swift Language Declaring Sets


Example

Sets are unordered collections of unique values. Unique values must be of the same type.

var colors = Set<String>()

You can declare a set with values by using the array literal syntax.

var favoriteColors: Set<String> = ["Red", "Blue", "Green", "Blue"]
// {"Blue", "Green", "Red"}