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 …

Architecture Patterns

An architecture pattern, also known as a software architecture pattern, is a reusable solution to a commonly occurring problem in software design. It provides a predefined structure, guidelines, and best practices for organizing and building software systems. Architecture patterns help developers create scalable, maintainable, and modular applications by promoting separation …

Variables & Properties

Creating a Variable Declare a new variable with var, followed by a name, type, and value: var num: Int = 10 Variables can have their values changed: num = 20 // num now equals 20 Unless they’re defined with let: let num: Int = 10 // num cannot change Property …

Data Types

There are six basic types of data types in Swift programming. Character The character data type is used to represent a single-character string. We use the Character keyword to create character-type variables. For example String The string data type is used to represent textual data. We use the String keyword to create string-type variables. …

OperationQueue

It’s built on top of Grand Central Dispatch (GCD) and provides a higher-level abstraction for managing concurrent operations. It’s an abstract class and never used directly. We can make use of the system-defined BlockOperation subclass or by creating your own subclass and start an operation by adding it to an OperationQueue or …

Global Dispatch Queues

GCD provides a set of global dispatch queues that are managed by the system. These queues are categorised into different quality-of-service (QoS) classes, indicating their priority. Main Dispatch Queue: The Main Dispatch Queue is a special serial dispatch queue associated with the main thread of your application. It’s the primary …

Grand Central Dispatch (GCD)

Grand Central Dispatch is a low-level API provided by Apple for managing concurrent operations. GCD abstracts away many of the complexities of thread management and provides a simple and efficient way to execute tasks concurrently. It provides a set of APIs for managing tasks and executing them concurrently on multicore …

Concurrency & Multithreading

Thread A thread is the smallest unit of execution within a process. It represents a single sequence of instructions that can be scheduled and executed independently by the operating system’s scheduler. Multithreading The term “multithreading” refers to the use of multiple threads within a single process. Multithreading allows different parts …