"jjj"
Swift Collections
Swift Collections
Swift collections are powerful containers used to store groups of items in a structured way. You can hold multiple values together—like names, numbers, or custom data types—and access or manage them efficiently.
Types of Collections:
1. Array
Stores items in an ordered list using index numbers.
Example:
let fruits = ["Apple", "Banana", "Mango"]
2. Set
Holds unique values in no specific order.
Example:
let colors: Set = ["Red", "Green", "Blue"]
3. Dictionary
Pairs data as key-value combinations.
Example:
let user = ["name": "John", "age": "30"]
Why Use Collections?
- Organize bulk data neatly
- Retrieve or update items easily
- Prevent duplicates (using Set)
- Link related info (using Dictionary)
Prefer Learning by Watching?
Watch these YouTube tutorials to understand GIT Tutorial visually:
What You'll Learn:
- 📌 Swift - Collection Types (Arrays, Sets & Dictionaries)
- 📌 Swift Dictionary - Swift Collections Explained