Collections
Collections
Introduction
Hello,
In this lesson, we will learn about collection types in Swift, which is one of the most important topics.
So let's start.
There are 3 collection types in Swift.
Array → Sequential collection types.
Set → Unordered and unique collection types.
Dictionary → Collection Types without order and in key-value pairs.
mutable - immutable
Whether our collection types are immutable or mutable is determined by our definition.
If we define it with a let statement, it will be immutable, while it is mutable if we define it with var.
If the value we defined will not change afterwards, using let will provide a performance advantage for the compiler to run more optimized.