Getting Started with Swift Testing: Apple's Modern Test Framework
Swift Testing replaces XCTest with a cleaner macro-based API. Learn how to write tests with @Test, #expect, parameterized inputs, and traits in Xcode 16+.
// 30 articles available
Swift Testing replaces XCTest with a cleaner macro-based API. Learn how to write tests with @Test, #expect, parameterized inputs, and traits in Xcode 16+.
Swift macros generate code at compile time, reducing boilerplate and catching errors early. Learn how to use built-in macros and understand how custom macros work.
A practical guide to Swift error handling covering throw/try/catch fundamentals, custom error types, Result, async error patterns, and typed throws introduced in Swift 6.
Understand the key difference between a UIView's frame and bounds properties, and when to use each in your iOS apps.
Master Swift's TaskGroup for parallel async work with proper cancellation, error handling, and result collection. Learn common patterns for batch operations and concurrent pipelines.
Swift 6 introduces typed throws, letting you declare exactly which error types a function can throw. Learn how this improves API contracts and enables exhaustive error handling.
Learn how to use Swift's RegexBuilder DSL to create readable, type-safe regular expressions with compile-time checking and strongly-typed captures.
A practical guide to implementing in-app purchases and subscriptions with StoreKit 2, covering products, transactions, subscription status, and SwiftUI integration.
Apple released Swift System Metrics 1.0, a package that collects process-level metrics like CPU time, memory usage, and file descriptors with a unified API across Linux and macOS.
Compare @AppStorage, UserDefaults, and SwiftData for persisting data in Swift apps. Learn when each approach makes sense and how to use them effectively.
Learn what the "some" keyword means in Swift, how opaque return types work, and why SwiftUI uses "some View" everywhere.
Swift offers actors, GCD, and locks for thread safety. Each solves the same problem differently. Here's how to choose.
Actors provide compile-time safety for shared mutable state in Swift. Here's when to use them and how they compare to older approaches.
Grand Central Dispatch remains a practical choice for thread safety in Swift, especially when you need synchronous access or are working with legacy code.
Locks offer the lowest overhead for thread synchronization in Swift. Here's when that matters and how to use them safely.
A practical introduction to async/await in Swift, covering the fundamentals you need to write concurrent code that's both safe and readable.
Both async/await and Grand Central Dispatch solve concurrency problems, but they approach them differently. Here's how to choose between them.
A refactoring mishap with arithmetic expressions led me down the rabbit hole of operator precedence differences between Swift and Objective-C. Here's what to watch for.
Learn how to use AlarmKit to schedule alarms and countdown timers that appear on the Lock Screen and Dynamic Island on iOS 26.
Learn how to use AppStore.ageRatingCode to read your app's current age rating and react to rating changes for parental consent compliance.
Failable initializers offer a cleaner alternative to if-let statements when your SwiftUI views depend on optional data.
How to traverse the view controller hierarchy to find the currently visible view controller.
How to generate random emoji characters in Swift using Unicode scalar ranges.
How to check available and total disk space on iOS devices using URL resource values.
Learn how to access and configure environment variables in Swift applications for configuration management, API keys, and feature toggles.
Learn how to use kCFStringTransformToUnicodeName to get the system name for any emoji.
Learn how to prevent typing with your physical keyboard from dismissing the software keyboard when running your Swift app in the iOS simulator.
A practical guide to the different methods for adding single elements, multiple elements, and inserting at specific positions in Swift arrays.
Learn how to access your app's App Delegate from anywhere in your Swift code, including from SwiftUI views.
Learn multiple approaches to replace characters and substrings in Swift strings, from simple replacements to pattern-based transformations.