App Development with Swift study materials
App Development with Swift study resources

App Development with Swift key terms

App Development with Swift · Get comfortable with the vocabulary.

Type inference

The compiler's ability to deduce a value's data type from how it is declared or used, letting you omit explicit type annotations when the meaning is unambiguous.

Related: Constant, Variable, Type safety
Constant

A named storage location declared with let whose value cannot be reassigned after initialization. Prefer constants whenever a value should remain fixed to prevent accidental mutation.

Related: Variable, Type inference
Variable

A named storage location declared with var whose value can be changed after initialization. Choosing a variable signals that mutation is intentional and permitted.

Related: Constant, Mutating method
String interpolation

A syntax for constructing a string by embedding expressions inside a string literal, so each expression's evaluated result is inserted into the surrounding text.

Related: Constant, Tuple
Tuple

A lightweight grouping of two or more values into one compound value. Elements may be accessed by position or name and need not share the same type.

Related: Array, Dictionary
Type safety

A language property that rejects operations on incompatible types and requires explicit conversions, catching many mistakes at compile time rather than allowing them to fail at runtime.

Related: Optional, Type inference
Closure

A self-contained block of code that can be passed around and executed later. It can capture values from its surrounding context and be written in a concise syntax.

Related: Trailing closure, Escaping closure, Higher-order function
Trailing closure

A closure written outside a function call's parentheses as the final argument, improving readability for callbacks and operations such as mapping or completion handlers.

Related: Closure, Escaping closure
Escaping closure

A closure passed to a function that may outlive the function call, such as one stored for later or run asynchronously, and therefore must be marked explicitly.

Related: Closure, Trailing closure
Higher-order function

A function that accepts one or more functions as arguments or returns a function as its result, enabling behavior to be abstracted and reused like data.

Related: Closure, Trailing closure
Guard statement

A control-flow statement that exits the current scope unless a condition is true, commonly used for early returns and clean optional unwrapping.

Related: Optional binding, Optional
Switch statement

A control-flow construct that chooses one branch by matching a value against patterns. Swift switches must be exhaustive and do not fall through by default.

Related: Enumeration, Guard statement
Argument label

The external name used when calling a function, which improves readability at the call site and may differ from the internal parameter name.

Related: Default parameter value, Inout parameter
Default parameter value

A value assigned to a parameter in a declaration that lets callers omit that argument, with the default used when no value is supplied.

Related: Argument label, Initializer
Inout parameter

A parameter that allows a function to modify the caller's variable directly. Callers pass an ampersand-prefixed variable, and the change persists after the call.

Related: Argument label, Mutating method
Structure

A value type that groups related properties and methods. Assigning or passing a structure copies it, so changes to one copy do not affect another.

Related: Class, Mutating method
Class

A reference type that groups properties and methods and supports inheritance. Multiple references can point to the same instance, so changes are shared among them.

Related: Structure, Initializer, Protocol
Enumeration

A type defining a group of related cases, optionally carrying associated or raw values. Enums model a value that must be one of a limited set of possibilities.

Related: Switch statement, Associated value, Protocol
Protocol

A contract declaring properties and methods that conforming types must implement. Protocols enable abstraction and polymorphism without requiring a shared superclass.

Related: Protocol extension, Delegate pattern
Protocol extension

A way to add default implementations and helper methods to a protocol so conforming types gain behavior without repeating the same code.

Related: Protocol, Structure
Computed property

A property that calculates its value from other data each time it is accessed rather than storing that value directly in memory.

Related: Initializer, Structure
Initializer

A special method that prepares an instance for use by assigning initial values to stored properties and performing any required setup.

Related: Structure, Class, Computed property
Associated value

Extra typed data attached to a specific enumeration case, allowing each case to carry different information that can be extracted when matched.

Related: Enumeration, Switch statement
Mutating method

A method on a value type that is permitted to modify the instance's stored properties. It must be marked and changes the value it is called on.

Related: Structure, Inout parameter
Array

An ordered collection storing multiple values of the same type at indexed positions, supporting iteration, insertion, removal, and access by index.

Related: Dictionary, Set, Optional
Dictionary

An unordered collection storing key-value pairs, where each unique key maps to one value and lookups are fast and type-safe.

Related: Array, Set
Set

An unordered collection that stores unique values of the same type, optimized for fast membership checks and removing duplicates from a sequence.

Related: Array, Dictionary
Optional

A type representing either a wrapped value or the absence of a value, forcing developers to handle nil explicitly before using the underlying value.

Related: Optional binding, Nil coalescing, Force unwrapping
Optional binding

A technique that safely unwraps an optional into a temporary constant or variable only when it contains a value, avoiding forced unwrapping.

Related: Optional, Guard statement, Nil coalescing
Nil coalescing

An operator that supplies a default value when an optional is nil, returning either the wrapped value or the fallback in a single expression.

Related: Optional, Optional binding
Force unwrapping

Accessing an optional's value with an exclamation mark, which crashes at runtime if the optional is nil and should be used only when absence is impossible.

Related: Optional, Optional binding
do-catch

A statement that runs code which may throw errors and handles each thrown error in matching catch clauses, keeping failures explicit and recoverable.

Related: Throwing function, Optional
Throwing function

A function marked to propagate errors to its caller instead of handling them internally, requiring callers to use try and address possible failures.

Related: do-catch, Optional
SwiftUI View

A value type describing a piece of user interface. Views are composed declaratively, and the framework re-renders them when underlying state changes.

Related: @State, @Binding, ViewModel
@State

A property wrapper for view-local mutable state. When the value changes, the view invalidates and re-renders, keeping the interface synchronized with its data.

Related: @Binding, SwiftUI View
@Binding

A property wrapper creating a two-way reference to state owned elsewhere, letting a child view read and modify another view's data.

Related: @State, SwiftUI View
ViewModel

An object holding presentation logic and state for a screen, exposing data to the view and keeping business logic out of user-interface code.

Related: SwiftUI View, @State, Delegate pattern
Delegate pattern

A design pattern where one object hands off responsibilities or events to another through a protocol, enabling customization without tight coupling.

Related: Protocol, ViewModel
Auto Layout

A constraint-based layout system that positions and sizes interface elements relative to each other and their container across different screen sizes.

Related: SwiftUI View, ViewController
ViewController

A UIKit object that manages a portion of the interface, coordinating views, user interactions, and data flow for a screen.

Related: Auto Layout, Delegate pattern