App Development with Swift key terms
App Development with Swift · Get comfortable with the vocabulary.
- Type inference
- Related: Constant, Variable, Type safety
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.
- Constant
- Related: Variable, Type inference
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.
- Variable
- Related: Constant, Mutating method
A named storage location declared with var whose value can be changed after initialization. Choosing a variable signals that mutation is intentional and permitted.
- String interpolation
- Related: Constant, Tuple
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.
- Tuple
- Related: Array, Dictionary
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.
- Type safety
- Related: Optional, Type inference
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.
- Closure
- Related: Trailing closure, Escaping closure, Higher-order function
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.
- Trailing closure
- Related: Closure, Escaping 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.
- Escaping closure
- Related: Closure, Trailing 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.
- Higher-order function
- Related: Closure, Trailing closure
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.
- Guard statement
- Related: Optional binding, Optional
A control-flow statement that exits the current scope unless a condition is true, commonly used for early returns and clean optional unwrapping.
- Switch statement
- Related: Enumeration, Guard 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.
- Argument label
- Related: Default parameter value, Inout parameter
The external name used when calling a function, which improves readability at the call site and may differ from the internal parameter name.
- Default parameter value
- Related: Argument label, Initializer
A value assigned to a parameter in a declaration that lets callers omit that argument, with the default used when no value is supplied.
- Inout parameter
- Related: Argument label, Mutating method
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.
- Structure
- Related: Class, Mutating method
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.
- Class
- Related: Structure, Initializer, Protocol
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.
- Enumeration
- Related: Switch statement, Associated value, Protocol
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.
- Protocol
- Related: Protocol extension, Delegate pattern
A contract declaring properties and methods that conforming types must implement. Protocols enable abstraction and polymorphism without requiring a shared superclass.
- Protocol extension
- Related: Protocol, Structure
A way to add default implementations and helper methods to a protocol so conforming types gain behavior without repeating the same code.
- Computed property
- Related: Initializer, Structure
A property that calculates its value from other data each time it is accessed rather than storing that value directly in memory.
- Initializer
- Related: Structure, Class, Computed property
A special method that prepares an instance for use by assigning initial values to stored properties and performing any required setup.
- Associated value
- Related: Enumeration, Switch statement
Extra typed data attached to a specific enumeration case, allowing each case to carry different information that can be extracted when matched.
- Mutating method
- Related: Structure, Inout parameter
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.
- Array
- Related: Dictionary, Set, Optional
An ordered collection storing multiple values of the same type at indexed positions, supporting iteration, insertion, removal, and access by index.
- Dictionary
- Related: Array, Set
An unordered collection storing key-value pairs, where each unique key maps to one value and lookups are fast and type-safe.
- Set
- Related: Array, Dictionary
An unordered collection that stores unique values of the same type, optimized for fast membership checks and removing duplicates from a sequence.
- Optional
- Related: Optional binding, Nil coalescing, Force unwrapping
A type representing either a wrapped value or the absence of a value, forcing developers to handle nil explicitly before using the underlying value.
- Optional binding
- Related: Optional, Guard statement, Nil coalescing
A technique that safely unwraps an optional into a temporary constant or variable only when it contains a value, avoiding forced unwrapping.
- Nil coalescing
- Related: Optional, Optional binding
An operator that supplies a default value when an optional is nil, returning either the wrapped value or the fallback in a single expression.
- Force unwrapping
- Related: Optional, Optional binding
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.
- do-catch
- Related: Throwing function, Optional
A statement that runs code which may throw errors and handles each thrown error in matching catch clauses, keeping failures explicit and recoverable.
- Throwing function
- Related: do-catch, Optional
A function marked to propagate errors to its caller instead of handling them internally, requiring callers to use try and address possible failures.
- SwiftUI View
- Related: @State, @Binding, ViewModel
A value type describing a piece of user interface. Views are composed declaratively, and the framework re-renders them when underlying state changes.
- @State
- Related: @Binding, SwiftUI View
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.
- @Binding
- Related: @State, SwiftUI View
A property wrapper creating a two-way reference to state owned elsewhere, letting a child view read and modify another view's data.
- ViewModel
- Related: SwiftUI View, @State, Delegate pattern
An object holding presentation logic and state for a screen, exposing data to the view and keeping business logic out of user-interface code.
- Delegate pattern
- Related: Protocol, ViewModel
A design pattern where one object hands off responsibilities or events to another through a protocol, enabling customization without tight coupling.
- Auto Layout
- Related: SwiftUI View, ViewController
A constraint-based layout system that positions and sizes interface elements relative to each other and their container across different screen sizes.
- ViewController
- Related: Auto Layout, Delegate pattern
A UIKit object that manages a portion of the interface, coordinating views, user interactions, and data flow for a screen.