Learn Swift
A structured guide to Swift, from the language fundamentals to modern concurrency, SwiftUI, testing, interoperability, and advanced Swift concepts.
Welcome
Start with what Swift is, why it exists, and how to set up a place to write your first program.
-
Swift Welcome Guide: What Swift Is and Why It Matters
Learn what Swift is, why developers use it, where it fits, its key features, common myths, and the best next steps for learning Swift.
-
Why Swift? A Practical Introduction to Apple’s Swift Language
Learn why Swift matters, what makes it distinctive, where it fits in Apple development, and whether it is the right language to learn today.
-
Installing Xcode and Swift Tools on macOS for Development
Learn how to install Xcode, command line tools, and Swift on macOS, verify the setup, fix common issues, and prepare your environment.
-
Swift Versions and Compatibility Guide for Apple Platforms
Learn how Swift versions differ, how to check compatibility, supported Apple platforms, migration tips, and safe recommendations for modern.
-
Swift Your First Program: print("Hello World") Explained
Learn how to write, run, and understand your first Swift program using print("Hello World"), with syntax, examples, mistakes, and practice.
-
Swift Playgrounds Guide: Learn, Experiment, and Build Faster
Learn what Swift Playgrounds is, why it matters, how it fits into Swift learning, and how to use it to experiment, practice, and prototype.
-
Swift on Linux: Setup, Usage, and Platform Considerations
Learn how to install Swift on Linux, verify your toolchain, configure your environment, fix common issues, and start building Swift apps.
Swift Basics
Learn how Swift stores values, names types, and lets you write comments that explain the code.
-
Swift Variables (var) and Constants (let) Explained
Learn how Swift variables and constants work, when to use var vs let, common errors, best practices, and practical examples in Swift 5+.
-
Swift Data Types Explained: Int, String, Double, Bool, and More
Learn Swift data types like Int, String, Double, Bool, Float, and Character, with syntax, examples, common mistakes, and best practices.
-
Swift Type Inference: How Swift Deduces Variable Types
Learn how Swift type inference works, when Swift can deduce types automatically, when to add annotations, and how to avoid common errors.
-
Swift Type Annotation: Syntax, Inference, and Best Practices
Learn what type annotation means in Swift, when to use it, how it differs from type inference, and how to avoid common type errors.
-
Swift Literals and Raw Strings (#"..."#) Explained
Learn how Swift literals work, how raw strings with #"..."# differ from normal strings, when to use them, and common mistakes to avoid.
-
Swift Comments and Documentation Comments (///) Explained
Learn how to write Swift comments and documentation comments using //, /* */, and ///, with syntax, examples, mistakes, and best practices.
Operators
See how Swift calculates, compares, and combines values, including ranges and custom precedence.
-
Master Arithmetic Operators in Swift: Practice Exercises & Solutions
Learn Swift arithmetic operators (+, -, *, /, %, +=) with beginner-friendly practice exercises and solutions.
-
Swift Comparison Operators: Best Practices & Exercises for Beginners
Learn Swift comparison operators with best practices, limitations, and beginner exercises.
-
Swift Logical Operators: Guide with Examples
Learn Swift logical operators (&&, ||, !) with examples, best practices, and tips to avoid mistakes for efficient iOS programming.
-
Ternary Operator
Learn the ternary operator in Swift from basics to advanced usage with examples, best practices, mistakes, and exercises.
-
Swift Range Operators (... and ..<): Complete Guide
Learn Swift range operators ... and ..< for loops, arrays, slicing, pattern matching, one-sided ranges, common mistakes, and best practices.
-
Swift Identity Operators (===, !==): Compare Object References
Learn how Swift identity operators === and !== compare class instances by reference, when to use them, common mistakes, and practical.
-
Swift Bitwise and Shift Operators: &, |, ^, ~, <<, >>
Learn Swift bitwise and shift operators with clear examples, binary reasoning, common mistakes, best practices, and a mini project.
-
Swift Overflow Operators (&+, &-, &*) Explained Clearly
Learn how Swift overflow operators &+, &-, and &* work, when to use them, how they differ from normal arithmetic, and common mistakes to.
-
Swift Operator Precedence and Custom Precedence Groups
Learn how Swift operator precedence works, how expressions are evaluated, and how to define custom precedence groups safely in Swift 5+.
Strings & Characters
Work with text in Swift, from interpolation and multiline strings to Unicode and regular expressions.
-
Swift String Interpolation: Syntax, Examples, and Best Practices
Learn Swift string interpolation with syntax, examples, mistakes, and best practices for inserting values and expressions into strings.
-
Swift String Methods: contains, hasPrefix, and More
Learn how Swift String methods like contains, hasPrefix, hasSuffix, lowercased, and replacingOccurrences work with clear examples and fixes.
-
Swift Multiline Strings: Syntax, Indentation, and Examples
Learn how Swift multiline strings work, including triple quotes, indentation rules, interpolation, escaping, and common mistakes.
-
Swift Unicode and Extended Grapheme Clusters Explained
Learn how Swift handles Unicode and extended grapheme clusters, why String indexing works differently, and how to avoid common text bugs.
-
Swift Regular Expressions: Regex Literals and RegexBuilder
Learn Swift regular expressions with regex literals and RegexBuilder, including syntax, matching, captures, common mistakes, and practical.
-
Swift String Performance and Copy-on-Write Explained
Learn how Swift String performance works, how copy-on-write avoids unnecessary copies, and which operations are cheap or expensive.
Control Flow
Choose paths through a program with conditions, switches, pattern matching, and early exits.
-
Swift If Else: Conditions, Syntax, and Practical Examples
Learn how to use if, else if, and else in Swift with clear syntax, examples, common mistakes, and best practices for everyday control flow.
-
Swift Switch Statements Explained with Syntax and Examples
Learn how Swift switch statements work, including syntax, pattern matching, ranges, tuples, where clauses, common mistakes, and best.
-
Swift Pattern Matching and where Clauses Explained
Learn Swift pattern matching and where clauses with switch, if case, for case, tuple matching, value filtering, common mistakes, and.
-
Swift defer: How to Run Cleanup Code Before Scope Exit
Learn how Swift defer works, when deferred code runs, execution order, common mistakes, and practical cleanup patterns with clear examples.
-
Swift Early Exits: guard, break, continue, and return
Learn how Swift early exits work with guard, break, continue, and return, including syntax, examples, common mistakes, and best practices.
Loops
Repeat work over sequences with for-in, while, stride, and forEach.
-
Swift for-in Loops: Syntax, Examples, and Common Mistakes
Learn how Swift for-in loops work, how to loop over ranges, arrays, dictionaries, and strings, plus common mistakes and best practices.
-
Swift while Loop: Syntax, Examples, and Common Mistakes
Learn how the Swift while loop works, when to use it, how it differs from repeat-while, and how to avoid common infinite loop mistakes.
-
Swift repeat-while Loop: Syntax, Examples, and Best Uses
Learn how Swift repeat-while loops work, when to use them, how they differ from while, and how to avoid common mistakes with practical.
-
Swift Iterating with stride: Forward and Reverse Looping
Learn how to iterate with stride in Swift using stride(from:to:by:) and stride(from:through:by:), with examples, mistakes, and best.
-
Swift forEach Explained: Iterating with Closures Clearly
Learn how Swift forEach works with closures, when to use it instead of for-in, common mistakes, limitations, and practical examples.
Collections
Store groups of values in arrays, sets, dictionaries, and the other collection types Swift uses.
-
A Beginner's Guide to Arrays in Swift
Beginner-friendly guide to arrays in Swift with examples and SwiftUI tips.
-
Swift Sets: How to Use Unordered Unique Collections
Learn how Swift Set works, how to create and update sets, use common operations, avoid mistakes, and choose Set vs Array in real code.
-
Swift Dictionaries: Key-Value Storage Explained Clearly
Learn how Swift dictionaries work, how to create, read, update, and loop through key-value pairs, plus common mistakes and best practices.
-
Swift Tuples Explained: Syntax, Examples, and Best Practices
Learn how Swift tuples work, how to create and access them, when to use them, and common tuple mistakes with clear examples.
-
Swift Sequence and Collection Protocols Explained Clearly
Learn Swift Sequence and Collection protocols, how they differ, required properties, indexing rules, and how to build custom iterable types.
-
Swift Slices and Subsequences: How ArraySlice Works
Learn how Swift slices and subsequences work, how ArraySlice differs from Array, common mistakes, and when to convert a slice to an array.
-
Swift Lazy Collections Explained with map, filter, and Performance
Learn how Swift lazy collections defer work, improve performance, and work with map, filter, and chaining, plus common mistakes and best.
-
Swift OptionSet Explained: Syntax, Use Cases, and Best Practices
Learn how Swift OptionSet works, how to define bitmask-style flags, combine options safely, avoid common mistakes, and choose it over enums.
Collection Methods & Properties
Inspect and transform collections with the methods you will use most often.
-
Swift Collection isEmpty and count: How and When to Use Them
Learn how Swift collection isEmpty and count work, when to use each, common mistakes, performance tips, and practical examples.
-
Swift first and last: Accessing Collection Boundary Elements
Learn how Swift first and last work on arrays, strings, and other collections, including optional results, safe access, examples, mistakes.
-
Swift contains and allSatisfy: Check Collection Values
Learn how Swift contains and allSatisfy work, when to use each, how closures behave, and how to avoid common collection-checking mistakes.
-
Swift reduce, compactMap, and flatMap Explained Clearly
Learn how Swift reduce, compactMap, and flatMap work, when to use each one, common mistakes, and practical examples for arrays and.
-
Swift map, filter, and sorted: Transforming Collections
Learn how Swift map, filter, and sorted work, when to use each, common mistakes, and practical examples for transforming arrays and other.
Functions
Define functions, pass arguments, return values, and understand how Swift names and overloads them.
-
Swift Defining Functions: Syntax, Parameters, and Return Values
Learn how to define functions in Swift with parameters, return values, labels, and examples.
-
Swift Parameters and Return Values Explained with Examples
Learn how Swift function parameters and return values work, including labels, defaults, tuples, inout, and common mistakes with clear.
-
Swift Argument Labels and Default Values Explained
Learn how Swift argument labels and default values work, how to call functions clearly, avoid common errors, and design better APIs.
-
Swift Variadic Parameters: Syntax, Examples, and Best Practices
Learn how Swift variadic parameters work, how to declare and call them, common mistakes, limitations, and practical examples.
-
Swift In-Out Parameters (inout): Syntax, Examples, and Rules
Learn how Swift inout parameters work, when to use them, how to pass values with &, and how to avoid common inout errors and mistakes.
-
Swift Nested Functions: Syntax, Scope, and Practical Examples
Learn how Swift nested functions work, when to use them, how scope and captures behave, and common mistakes with clear Swift 5 examples.
-
Swift Function Overloading Explained with Syntax and Examples
Learn Swift function overloading, how it works, how Swift chooses overloads, common mistakes, and practical examples using Swift 5+ syntax.
-
Swift Function Types as Parameters and Return Values
Learn Swift function types, including how to pass functions as parameters, return functions from functions, and avoid common mistakes.
-
Swift @discardableResult: Ignore Function Return Values Safely
Learn what Swift @discardableResult does, when to use it, how it differs from normal returns, and how to avoid common mistakes and warnings.
-
Swift Closures Explained: Syntax, Capture Values, and Uses
Learn Swift closures with clear syntax, examples, capture lists, trailing closures, common mistakes, and practical uses in Swift 5+ code.
Optionals
Represent missing values safely and unwrap them without guessing.
-
Swift Optionals Explained: What They Are and How They Work
Learn what Swift optionals are, why they matter, how to declare and unwrap them, and how to avoid common nil-related mistakes.
-
Swift Optional Binding with if let and guard let Explained
Learn Swift optional binding with if let and guard let, including syntax, examples, differences, and common mistakes when unwrapping.
-
Swift Nil-Coalescing Operator (??): Syntax, Examples, and Mistakes
Learn how Swift’s nil-coalescing operator (??) works, when to use it with optionals, how it compares to if let, and common mistakes to.
-
Swift Optional Chaining Explained with Syntax and Examples
Learn how Swift optional chaining works, how to safely access nested optional values, avoid common errors, and write cleaner Swift 5+ code.
-
Swift Force Unwrapping (!) Explained with Safe Usage Examples
Learn what Swift force unwrapping (!) does, when to use it, why it can crash your app, and safer alternatives with clear examples.
-
Swift Implicitly Unwrapped Optionals Explained Clearly
Learn what implicitly unwrapped optionals are in Swift, how they work, when to use them, how they differ from regular optionals, and common.
Custom Types
Model data with structs, enumerations, tuples, and the other value types Swift encourages.
-
Swift Structs Explained: Properties, Methods, and Value Types
Learn how Swift structs work, including properties, methods, initializers, value semantics, common mistakes, and when to use structs vs.
-
Swift Enumerations Explained: Cases, Raw Values, and Associated Values
Learn Swift enumerations with clear examples of enum cases, raw values, associated values, switching, and when to use enums in Swift 5+.
-
Swift Enums: Associated Values vs Raw Values Explained
Learn the difference between Swift enum associated values and raw values, when to use each, common mistakes, and practical examples in.
-
Swift Type Aliases (typealias): Syntax, Uses, and Best Practices
Learn how Swift type aliases work, when to use typealias, how they differ from new types, and common mistakes with closures, tuples, and.
-
Swift Value Semantics vs Reference Semantics Explained
Learn Swift value semantics vs reference semantics, how structs and classes behave, when copies happen, and how to choose the right type.
-
Swift Struct Memberwise Initializers Explained with Examples
Learn how Swift struct memberwise initializers work, when Swift creates them automatically, how custom init methods affect them, and common.
Classes
Use reference types when identity, inheritance, or a shared instance is the right model.
-
Swift Defining Classes: Syntax, Properties, Methods, and Init
Learn how to define classes in Swift, including syntax, properties, methods, initializers, inheritance basics, and common mistakes.
-
Swift Class Properties and Methods Explained with Examples
Learn how Swift class properties and methods work, including syntax, examples, common mistakes, best practices, and real-world usage.
-
Swift Initializers: Designated, Convenience, and Failable Initializers
Learn how Swift initializers work, including designated, convenience, and failable initializers, with rules, examples, mistakes, and best.
-
Swift Inheritance: Subclassing Classes and Overriding Methods
Learn Swift inheritance, subclassing, method overriding, designated and convenience initializers, and common mistakes with clear examples.
-
Swift Method Overriding: How Subclasses Replace Behavior
Learn how method overriding works in Swift, when to use override, how super works, and how to avoid common inheritance errors.
-
Swift Type Properties and Methods: static vs class Explained
Learn Swift type properties and type methods using static and class, including syntax, examples, differences, common errors, and best.
-
Swift Deinitializers: How deinit Works and When It Runs
Learn how Swift deinitializers work, when deinit runs, what cleanup belongs there, common mistakes, and how ARC affects object destruction.
-
Swift Subscripts Explained: Syntax, Examples, and Best Practices
Learn how Swift subscripts work, how to define them in types, use multiple parameters, avoid common errors, and write cleaner.
-
Swift Reference Identity (===): Compare Class Instances Safely
Learn how Swift reference identity works with === and !==, how it differs from ==, when to use it with classes, and common mistakes to.
Protocols & Extensions
Describe shared behavior with protocols and add methods to existing types.
-
Swift Protocols Explained: What Protocols Are and How to Use Them
Learn what Swift protocols are, how they define shared behavior, how to conform to them, and common mistakes beginners make.
-
Swift Protocol Properties and Methods Explained Clearly
Learn how Swift protocol properties and methods work, how to declare requirements, conform types, and avoid common mistakes.
-
Swift Protocol Inheritance Explained with Syntax and Examples
Learn Swift protocol inheritance with clear syntax, examples, use cases, and common patterns for combining shared requirements in Swift 5+.
-
Swift Protocol Conformance: Rules, Syntax, and Best Practices
Learn how Swift protocol conformance works, how to adopt protocols, satisfy requirements, fix common errors, and design cleaner APIs.
-
Swift Associated Types Explained for Protocols and Generics
Learn how Swift associated types work in protocols, how they differ from generics, and how to use them in practical, type-safe code.
-
Swift Default Implementations in Protocol Extensions Explained
Learn how Swift default implementations work in protocol extensions, when to use them, how dispatch behaves, and common mistakes to avoid.
-
Swift Extensions Basics: Add Behavior to Existing Types
Learn Swift extensions basics, including syntax, computed properties, methods, protocol conformance, common mistakes, and practical.
-
Swift Extensions: Adding Functionality to Existing Types
Learn how Swift extensions add methods, properties, initializers, and protocol conformance to existing types, plus rules, limits, and.
-
Swift Protocol-Oriented Programming (POP) Explained Clearly
Learn Swift Protocol-Oriented Programming (POP), how protocols and protocol extensions work, when to use them, and common mistakes to avoid.
-
Swift Conditional Conformance Explained with Practical Examples
Learn how Swift conditional conformance works, when to use it, how to write it, and how to avoid common errors with generic types and.
-
Swift Existentials (any) and Self Requirements Explained
Learn Swift existential types with any, why Self requirements limit protocol use, and how to fix common compiler errors with examples.
-
Swift Primary Associated Types Explained with Examples
Learn what Swift primary associated types are, how they simplify protocol constraints, and how to use them in generic code and existentials.
Advanced Swift
Go further into generics, type casting, property wrappers, result builders, and related language features.
-
Swift Generics for Functions and Types: Complete Guide
Learn how Swift generics work in functions and types, with syntax, constraints, examples, and practical patterns for reusable type-safe.
-
Swift Constraints with where in Generics and Extensions
Learn how Swift constraints with where work in generics and extensions, when to use them, common mistakes, and practical examples.
-
Swift KeyPaths (Person.name): A Complete Guide
Learn Swift key paths, how \Person.name works, and how to read, write, and pass property references in type-safe Swift code.
-
Swift Custom Operators: Define and Use Your Own Symbols
Learn how Swift custom operators work, how to declare precedence and associativity, and when to use them safely in real code.
-
Swift Result Type (Result<Success, Failure>): Complete Guide
Learn Swift Result<Success, Failure>: how to model success and failure, write throwing APIs, switch safely, and avoid common mistakes.
-
Swift Type Casting: Using is, as, as?, and as!
Learn Swift type casting with is, as, as?, and as!. See how to test types, cast safely, handle failures, and avoid common runtime crashes.
-
Swift Metatypes: Using Type.self and Protocol.self
Learn Swift metatypes, Type.self, and Protocol.self with clear examples, syntax, common mistakes, and practical uses for runtime type.
-
Swift Opaque Types (some): Complete Guide and Examples
Learn how Swift opaque types using some work, when to use them, how they differ from protocols and generics, and common mistakes to avoid.
-
Swift Type Erasure: Hide Concrete Types Behind a Common API
Learn Swift type erasure, why it exists, how to build erasing wrappers, and how to use AnySequence, AnyHashable, and custom abstractions.
-
Swift Property Wrappers: A Practical Guide to @propertyWrapper
Learn Swift property wrappers, how @propertyWrapper works, how to create custom wrappers, and common mistakes with real Swift examples.
-
Swift Result Builders: Build Custom DSLs and Declarative APIs
Learn Swift result builders, how they transform blocks into values, and how to use them to create clean declarative APIs.
-
Swift Attributes and Annotations: @available, @MainActor, @Sendable
Learn how Swift attributes and annotations work, including @available, @objc, @main, @frozen, @inline, @MainActor, and @Sendable.
-
Swift Modules and Imports: Using import and @_exported
Learn how Swift modules and imports work, when to use import, what @_exported does, and common mistakes when organizing Swift code.
-
Swift Build Config and Conditional Compilation Explained
Learn Swift build config and conditional compilation with #if, #available, os(), arch(), swift(), and canImport() using clear examples and.
Higher-Order Functions
Transform collections with map, filter, reduce, and the functions built on the same idea.
-
Swift map, filter, reduce: How to Transform Collections
Learn how Swift map, filter, and reduce work, when to use each one, common mistakes, and practical examples for transforming arrays.
-
Swift flatMap vs compactMap: How to Transform Collections
Learn how Swift flatMap and compactMap work, when to use each, how they differ, and how to avoid common mistakes with practical examples.
-
Swift forEach vs for-in: Differences, Use Cases, and Mistakes
Learn the difference between Swift forEach and for-in, when to use each, how control flow behaves, and common mistakes beginners make.
Swift Error Handling
Report and recover from failures with throwing functions, try, and do-catch.
-
Swift Throwing Functions (throws): Syntax, Usage, and Errors
Learn how Swift throwing functions work with throws, try, catch, rethrows, and do-catch, plus common mistakes and best practices.
-
Swift try, try?, and try! Explained with Examples
Learn how Swift try, try?, and try! handle throwing functions, optionals, and crashes, with examples, mistakes, and best practices.
-
Swift do-catch Blocks: Error Handling Syntax and Examples
Learn how Swift do-catch blocks work, when to use try, catch, try?, and try!, plus common errors, examples, and best practices.
Memory & Performance
Understand how Swift keeps memory in check, and where copies and references matter.
-
Swift ARC (Automatic Reference Counting): Memory Management Explained
Learn how Swift ARC manages object lifetimes, retain cycles, strong and weak references, and how to avoid memory leaks in Swift code.
-
Swift Strong, Weak, and Unowned References Explained
Learn how Swift strong, weak, and unowned references work, when to use each one, and how they help prevent reference cycles and leaks.
-
Swift Retain Cycles & Memory Leaks: A Practical Guide
Learn how retain cycles and memory leaks happen in Swift, how to spot them, and how to fix them with weak, unowned, and better ownership.
-
Swift Value Semantics vs Reference Semantics Explained
Learn Swift value semantics vs reference semantics, how structs and classes behave, when copies happen, and how to choose the right type.
-
Swift Copy-on-Write Optimization Explained
Learn how Swift copy-on-write works, why it improves performance, and how to design value types that share storage safely.
-
Swift Lazy Properties: Deferred Initialization and Performance
Learn how Swift lazy properties work, when to use them, how initialization is deferred, and common mistakes with lazy stored properties.
Concurrency
Run work concurrently with async/await, tasks, and actors.
-
Grand Central Dispatch (GCD) in Swift: Queues, Async, and Sync
Learn Grand Central Dispatch in Swift: queues, async vs sync, main queue usage, common mistakes, and practical concurrency examples.
-
Swift Operation Queues: Concurrency, Priorities, and Dependencies
Learn how Swift operation queues schedule work, manage dependencies, control priorities, and replace manual thread management with safer.
-
Swift Async & Await: Writing and Reading Asynchronous Code
Learn Swift async and await, how to call async functions, handle errors, and write readable concurrency code with practical examples.
-
Swift Structured Concurrency: Task Groups, Async Let, and Child Tasks
Learn Swift structured concurrency, including async let, task groups, child tasks, cancellation, and how it keeps async work organized.
-
Swift Actors: A Beginner-Friendly Guide to Safe Concurrency
Learn Swift actors, how they protect mutable state, how actor isolation works, and how to use them safely in concurrent code.
-
Swift Task Groups: Running and Collecting Concurrent Child Tasks
Learn how Swift task groups work, when to use them, how to collect results, and how to avoid common concurrency mistakes.
-
Swift Cancellation Handling: Cancel Tasks Safely and Cleanly
Learn Swift cancellation handling in async tasks, how to check for cancellation, stop work early, and clean up resources correctly.
-
Swift Sendable, @MainActor, Global Actors, and Isolation Rules
Learn Swift concurrency isolation rules, Sendable, @MainActor, and global actors.
-
Swift async let, nonisolated, and Main-Thread Affinity
Learn how async let, nonisolated, and main-thread affinity work in Swift concurrency, with examples, mistakes, and UI-safe patterns.
SwiftUI
Build interfaces with SwiftUI views, layout, navigation, and state.
-
Introduction to SwiftUI for Building Apple App Interfaces
Learn what SwiftUI is, how it works, where it fits in Apple development, and why developers use it to build iPhone, iPad, Mac, and watch.
-
SwiftUI Views and Modifiers Explained with Practical Examples
Learn how SwiftUI views and modifiers work, how to build interfaces step by step, avoid common mistakes, and write cleaner SwiftUI code.
-
SwiftUI VStack, HStack, and ZStack Explained Clearly
Learn how SwiftUI VStack, HStack, and ZStack arrange views, when to use each one, common mistakes, spacing, alignment, and real examples.
-
SwiftUI LazyVGrid and LazyHGrid Explained with Examples
Learn how SwiftUI LazyVGrid and LazyHGrid work, how to define grid items, build adaptive layouts, and fix common grid mistakes.
-
SwiftUI Lists and ForEach: Displaying Dynamic Data Clearly
Learn how SwiftUI List and ForEach work, how to show dynamic data, handle identity correctly, and avoid common errors in repeating views.
-
SwiftUI Navigation with NavigationView and NavigationStack
Learn SwiftUI navigation using NavigationView and NavigationStack, including links, titles, paths, common mistakes, and when to use each.
-
SwiftUI State Management: @State, @Binding, @ObservedObject, @EnvironmentObject
Learn SwiftUI state management with @State, @Binding, @ObservedObject, and @EnvironmentObject. See when to use each one and common mistakes.
-
SwiftUI Animations & Transitions: A Complete Beginner's Guide
Learn SwiftUI animations and transitions with state-driven examples, view modifiers, common mistakes, and practical tips for smooth UI.
-
SwiftUI Custom Views: Build Reusable, Composable UI Components
Learn how to create SwiftUI custom views, pass data with properties and bindings, reuse components, and avoid common view design mistakes.
-
Drawing with SwiftUI: Path and Shape Basics
Learn how SwiftUI Path and Shape work, how to draw lines, curves, and custom shapes, and when to use each in real apps.
-
SwiftUI for iOS Widgets: Building Home Screen Widgets
Learn how SwiftUI powers iOS widgets with WidgetKit, timelines, views, and configuration so you can build useful Home Screen widgets.
-
Combine Basics in Swift: Reactive Programming with Publishers and Subscribers
Learn Combine basics in Swift, including publishers, subscribers, operators, cancellation, and how reactive data flow works in practice.
-
Result Builders in SwiftUI: How Declarative View Code Works
Learn how SwiftUI result builders turn declarative view code into trees, how they work, common mistakes, and practical usage patterns.
Interoperability
Call Objective-C and C from Swift, and move data across those language boundaries.
-
Swift & Objective-C Interoperability: A Practical Guide
Learn how Swift and Objective-C interoperate, including @objc, @IBOutlet, bridging, nullability, and common compatibility pitfalls.
-
Using C Libraries in Swift: Importing and Calling C APIs
Learn how to import C libraries in Swift, call C functions, use C structs and enums, and fix common interoperability errors.
-
Swift Bridging Headers: Use Objective-C from Swift Projects
Learn what a Swift bridging header is, how to configure it, and how to import Objective-C headers so Swift code can call them safely.
-
Swift Mixed-Language Projects: Integrating Swift with Other Code
Learn how Swift mixed-language projects work, including bridging, targets, headers, and common setup issues when combining Swift with other.
-
Swift Bridging Types: String ↔︎ NSString and Value Bridging
Learn how Swift bridges types like String and NSString, when bridging happens automatically, and how to avoid common interoperability bugs.
-
Swift KVC, KVO, and dynamic: Interoperability Guide
Learn how Swift works with Key-Value Coding, Key-Value Observing, and dynamic dispatch, plus when to use @objc and dynamic.
Testing & Debugging
Check behavior with tests and find problems with the debugger and logging tools.
-
Unit Testing with XCTest in Swift: A Practical Beginner Guide
Learn how to write, run, and organize Swift unit tests with XCTest, including assertions, setup, async tests, and common mistakes.
-
Swift UI Testing: Xcode UI Tests for Apps and Flows
Learn Swift UI testing with Xcode: write stable UI tests, launch apps, tap controls, verify text, and debug common XCTest issues.
-
Debugging in Xcode: Breakpoints, LLDB, and Console Basics
Learn how to debug Swift apps in Xcode using breakpoints, the LLDB console, variables view, and common troubleshooting workflows.
-
Swift Performance Testing: Measure and Benchmark Code Correctly
Learn how to write Swift performance tests, use XCTest metrics, compare runs, and avoid common benchmarking mistakes in Xcode.
-
Swift Assertions: assert, precondition, and fatalError
Learn how Swift assertions work, when to use assert, precondition, and fatalError, and how they differ in debug and release builds.
-
LLDB Basics in Swift: Debugging Your Code in Xcode
Learn LLDB basics in Swift: breakpoints, stepping, printing variables, evaluating expressions, and common debugging mistakes in Xcode.
-
Swift Logging with os.Logger: A Practical Guide to Structured Logs
Learn how to use Swift os.Logger for fast, structured logging, privacy control, log levels, and best practices for debugging and testing.
Expert Topics
Study the language features used in libraries, macros, and lower-level Swift.
-
Swift Package Manager (SPM): Packages, Targets, and Dependencies
Learn Swift Package Manager (SPM): package structure, dependencies, targets, products, commands, and common setup and troubleshooting tips.
-
Swift Modularization & Large Codebases: Building Maintainable Apps
Learn Swift modularization for large codebases, including module boundaries, targets, dependencies, testing, and common scaling pitfalls.
-
Swift Macros (Swift 5.9+) — A Practical Guide
Learn Swift macros in Swift 5.9+: how they work, how to write and use them, common mistakes, and when to choose them.
-
Domain-Specific Languages (DSLs) in Swift: Build Clearer APIs
Learn what DSLs in Swift are, why they matter, how result builders enable them, and common mistakes when designing expressive APIs.
-
Swift Metaprogramming: Reflection, Macros, and Code Generation
Learn Swift metaprogramming with reflection, macros, and code generation. See how to inspect types, reduce boilerplate, and avoid common.
-
Swift Reflection & Mirror API: Inspecting Values at Runtime
Learn Swift Mirror reflection to inspect types, properties, children, and labels at runtime, plus common pitfalls, limits, and examples.
-
Contributing to Swift Open Source: A Practical Developer Guide
Learn how to contribute to Swift open source projects, from finding issues and setting up a workflow to submitting pull requests and.
-
Unsafe Swift: Pointers, Buffers, and Unmanaged
Learn Swift unsafe pointers, buffers, and Unmanaged: how they work, when to use them, memory rules, common mistakes, and safe patterns.
-
Swift MemoryLayout and Alignment: Size, Stride, and Padding
Learn how Swift MemoryLayout reports size, stride, and alignment, why padding exists, and how these values affect structs, arrays, and.
Core Rules of Thumb
Apply the habits that keep everyday Swift clear: naming, immutability, and small functions.
-
Swift Naming Conventions: camelCase, PascalCase, and Constants
Learn Swift naming conventions for types, variables, functions, and constants, including camelCase, PascalCase, and clear, idiomatic style.
-
Swift Immutability First: Why You Should Prefer let Over var
Learn Swift’s immutability-first rule: when to use let over var, how it improves safety, and common mistakes to avoid in real code.
-
Swift Optionals: How to Use Optionals Wisely
Learn how to use Swift optionals wisely with safe unwrapping, defaults, pattern matching, common mistakes, and practical best practices.
-
Swift Value Types vs Classes: Why Structs Are the Default Choice
Learn why Swift recommends structs over classes, when value semantics help, and how to choose the right type for safer, simpler code.
-
Swift Protocol-Oriented Programming Over Inheritance
Learn why Swift favors protocol-oriented programming over inheritance, how it works, and when to choose protocols, protocol extensions, or.
-
Swift Force Unwrapping (!) — Why to Avoid It and What to Use
Learn why Swift force unwrapping is risky, how crashes happen, safer alternatives like optional binding and guard let, and when !
-
Swift Small Functions: How to Keep Functions Small and Focused
Learn how to keep Swift functions small and focused with practical rules, examples, common mistakes, and refactoring tips for cleaner code.
-
Swift Type Inference vs Explicit Types: When to Rely on Each
Learn when Swift type inference improves clarity and when explicit types make code safer, easier to read, and less error-prone.
-
Swift forEach: Prefer forEach Only for Side Effects
Learn when to use Swift forEach for side effects, how it differs from map and loops, and common mistakes to avoid.
-
Swift guard for Early Exits: How and When to Use It
Learn how Swift guard works for early exits, cleaner control flow, and safe unwrapping with practical examples, mistakes, and best.
-
Swift Readability Over Cleverness: Write Clearer Code
Learn why readable Swift is better than clever Swift, with examples, common mistakes, and practical rules for clearer code.
Appendix
Use the glossary, style notes, and migration guides when you need a reference rather than a lesson.
-
Swift Evolution Proposals: How Swift Language Changes Are Proposed
Learn what Swift Evolution proposals are, how they work, how to read them, and how they shape Swift language changes and version updates.
-
Swift Common Mistakes and Best Practices
Learn the most common Swift mistakes, how to fix them, and practical best practices for safer, clearer Swift code.
-
Swift Style Guide & Linting: Writing Consistent, Safe Code
Learn how Swift style guides and linting improve readability, catch mistakes early, and keep teams aligned with practical rules and.
-
Swift Migration Guides: Upgrading from Swift 4 to 5 to 6
Learn how to migrate Swift projects from 4 to 5 to 6, handle source changes, fix compatibility issues, and upgrade safely.
-
Glossary of Swift Terms: Key Language Concepts Explained
Learn essential Swift glossary terms, from variables and optionals to closures, structs, value types, and protocols, with clear.
-
Swift DocC and Doc Comments: Write API Documentation That Scales
Learn how Swift DocC and doc comments work, how to write documentation comments, and how to generate readable API docs from Swift source.