How to work with swift sets?

Example:


  var colors: Set = ["Red", "Green", "Blue"]
  colors.insert("Yellow")
  

Solution:

Sets in Swift are unordered collections of unique elements. In this example, we create a set of colors and then insert a new color.

Beginner's Guide to Swift