#Swift
Posts tagged with Swift.
- Associated Values: Put Data Where It Belongs
Model Swift enum cases with their own data, extract associated values with patterns, and understand what this design does and does not guarantee.
- Swift Log: Why Context Metadata Belongs at the Logging Boundary
How Swift Log combines stable logger metadata, runtime providers, and per-event overrides without coupling application code to a backend.
- switch: Let Exhaustiveness Work for You
Use exhaustive Swift switch matching to model every state, bind associated values, and understand when a default branch hides changes.
- SwiftNIO: Why ByteBuffer Has Two Cursors
How separate reader and writer indexes make partial network messages manageable.
- for case and where: Filter While You Iterate
Use Swift for case to select matching values during iteration, bind associated data, and add precise where conditions without hiding the loop's intent.
- if case and guard case: Match One Shape Without a switch
Match one Swift enum case, bind its associated values, add conditions, and decide when guard case or an exhaustive switch is clearer.
- Swift Algorithms: Sliding Windows Without Copies
How swift-algorithms models overlapping collection slices with paired indexes.
- Nil Coalescing: Provide Defaults Without Branching
See how Swift's nil-coalescing operator chooses defaults lazily, composes with optional chaining, and differs from validation and dictionary insertion.
- swift-parsing: One Grammar for Parsing and Printing
How swift-parsing uses ParserPrinter to parse and print with one grammar, why printing runs backward, and where round-trip guarantees need care.
- SwiftUI Introspect: Finding Views Without Private APIs
How SwiftUI Introspect finds the right UIKit or AppKit view with paired markers, bounded traversal, and explicit OS version rules.
- Optional Chaining: Let Absence Flow Through an Expression
Follow optional values through Swift properties, calls, and subscripts—and learn what optional chaining skips, returns, and cannot protect.
- swift-async-algorithms: Backpressure at the Handoff
How AsyncChannel makes Swift producers wait for demand, handles cancellation races, and differs from buffered streams.
- swift-format: From Syntax Trees to Readable Code
Why swift-format needs syntax trees, rewriting rules, and a pretty printer, and why linting takes a different path.
- Optional Binding: Turn an Optional Into a Value
Learn how Swift optional binding creates safe local values, combines checks, and controls where unwrapped values are available.
- Swift Argument Parser: One Model for CLI Commands
A source-level look at how Swift Argument Parser turns property wrappers and command types into parsing rules, validation, usage, and help.
- guard: Keep the Main Path Flat
Use Swift guard to state requirements early, keep successful optional bindings in scope, and leave the main path easy to follow.
- Nuke: Coalescing Image Work Across Swift Concurrency
A source-level look at how Nuke shares downloads, decoding, and image processing across concurrent requests without tying cancellation to a single caller.
- Swift Collections: Why Deque Uses a Ring Buffer
A source-level look at how Swift Collections implements Deque with circular storage, copy-on-write value semantics, and familiar integer indexing.
- Tuple Patterns: Destructure Values Where You Use Them
Use Swift tuple patterns to take tuples apart, ignore values you do not need, and match several values at once.
- GRDB: Turning SQLite Queries into Live Application State
A source-level look at how GRDB turns SQLite query regions and transaction events into live application state.
- Tuples: Group Values Without Creating a Type
Swift tuples give a few related values a useful local shape without forcing every temporary relationship into a new named type.
- swift-dependencies: Dependency Injection with Task-Local Values
A source-level look at how swift-dependencies scopes dependency values with TaskLocal state, makes overrides testable, and integrates the same model with SwiftUI.
- swift-snapshot-testing: Snapshot Testing as a Composition of Transform and Diff
A source-level look at how swift-snapshot-testing separates value transformation from diffing, and why that makes snapshot strategies reusable far beyond screenshots.
- swift-http-types: Giving Swift a Shared Vocabulary for HTTP
A source-level look at how swift-http-types models HTTP messages, preserves protocol semantics, and bridges the same types into Foundation.
- swift-jobs: Separating Job Semantics from Queue Storage
A source-level look at how swift-jobs separates job definitions, processing policy, and queue storage while integrating retries, timeouts, and graceful shutdown.
- swift-service-lifecycle: Making Service Lifetime Part of Swift Structured Concurrency
A source-level look at how swift-service-lifecycle owns long-running Swift services, coordinates shutdown, and fits structured concurrency.