There are a couple of ways in which we can initialize a set. Just like the array and dictionary types, Swift needs to know what type of data is going to be stored in it. This means that we must either tell Swift the type of data to store in the set or initialize it with some data so that it can infer the data type.
Just like the array and dictionary types, we use the var and let keywords to declare if the set is mutable or not:
//Initializes an empty set of the String type var mySet = Set<String>() //Initializes a mutable set of the String type with initial values var mySet = Set(["one", "two", "three"]) //Creates a immutable set of the String type. let mySet = Set(["one", "two", "three"])