It is an unordered collection (meaning you won't get the elements in the same order as you defined) of unique, non-nil elements. It must conform to the Hashable protocol . This means it has to provide a hashValue property. This is important because sets are unordered and hashValue is used to access the elements of the sets.
3. Sets
Get Data Structures and Algorithms in Swift: Implement Stacks, Queues, Dictionaries, and Lists in Your Apps now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.