Lightweight dependency injection and unit testing using async functions
Explores using Swift's async/await for lightweight dependency injection and easier unit testing of asynchronous networking code.
Sundell is an independently run site by John Sundell, featuring articles, podcasts, and videos about Swift, iOS, and Mac development. It offers high-quality, privacy-friendly content for developers of all skill levels, with a strong focus on performance and craftsmanship.
41 articles from this blog
Explores using Swift's async/await for lightweight dependency injection and easier unit testing of asynchronous networking code.
Explains the role of Tasks in Swift's concurrency system, focusing on bridging synchronous UI code with asynchronous operations and automatic main thread handling.
A guide to writing unit tests for Swift code that uses async/await, covering asynchronous test methods and error handling.
Explains the performance difference between using `isEmpty` and `count == 0` to check for empty collections in Swift, focusing on time complexity.
Explains how to make Swift's new async/await system APIs work on older iOS versions using continuations.
Xcode 13.2 beta brings backward compatibility for Swift's async/await and other concurrency features to older OS versions like iOS 13.
Explains how to use Swift's generic type constraints with the 'where' keyword to create specialized extensions for types and protocols.
A tutorial on implementing editable lists in SwiftUI, covering item editing, moves, deletions, and enabling edit mode.
How to preview SwiftUI views in landscape orientation in Xcode 13, including workarounds for iOS 15 API compatibility.
Explains how to use Combine's share operator in Swift to prevent duplicate network calls and efficiently reuse publishers.
Explains how Swift 5.5's Codable API automatically synthesizes encoding/decoding for enums, including those with associated values.
Explores Swift's async sequences, streams, and Combine, detailing how to build custom sequences and iterators for asynchronous operations.
Explains how to use Swift 5.5's static protocol APIs to create instances with dot syntax, improving code readability and SwiftUI integration.
Explains how to use Swift's @unknown default attribute in switch statements to handle future enum cases safely, preventing bugs.
A technical guide on how to simultaneously apply a stroke (border) and a fill to a SwiftUI shape, addressing a common UI development challenge.
A guide on programmatically dismissing modal and detail views in SwiftUI using the presentationMode environment value.
Explains how to integrate Swift's async/await functions into Combine pipelines using custom asyncMap operators.
Explains how to use Swift's availability checks to adopt new iOS APIs while maintaining backward compatibility with older system versions.
Explains how to customize JSON encoding/decoding for external Swift types like TimeZone using wrapper types and Codable.
Explains how Swift 5.5's MainActor attribute automates dispatching UI updates to the main queue, replacing manual DispatchQueue.main calls.