Sets

A Set in Swift is an unordered collection of unique elements. Unlike an Array, it does not allow duplicate values and does not maintain the order of elements. Key Set Operations Set Operations 1. Union Combines all unique elements from two sets. 2.Intersection Finds common elements between two sets. Difference …

Dictionary

A dictionary in Swift is a collection type that stores key-value pairs. Each key is unique and you use it to access its corresponding value. Iterating Over a Dictionary

Array

Array is an ordered, random-access collection type. Arrays are one of the most commonly used data types in an app. We use the Array type to hold elements of a single type, the array’s Element type. An array can store any kind. Empty arrays The following three declarations are equivalent: …

Tuples

Tuples group multiple values into a single compound value. The values within a tuple can be of any type and do not have to be of the same type as each other. Tuple with Multiple Types Nested Tuples

Operators in Swift

Types of Operators 1. Assignment Operator Assigns the value on the right-hand side to the variable or constant on the left-hand side. (=) 2. Arithmetic Operators Swift provides standard arithmetic operators for mathematical operations: 3. Compound Assignment Operators These combine an operation with assignment, allowing you to update a variable …