Decoding Swift types that require additional data
Explains how to decode Swift Codable types when required data is missing from the JSON source, using partial models.
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
Explains how to decode Swift Codable types when required data is missing from the JSON source, using partial models.
Explores using Swift's defer keyword to manage resources in async and throwing functions, improving code safety and elegance.
The author announces the return of the Swift by Sundell blog after a two-year hiatus, citing family changes and a renewed passion for Swift programming.
Explores the architectural differences between creating custom SwiftUI views and using modifiers, with examples of how to achieve similar UI results.
Explores using Swift 5.7's opaque return types (`some`) with primary associated types to simplify generic protocol returns, reducing the need for manual type erasure.
A guide to dynamically switching between SwiftUI's HStack and VStack layouts based on device orientation or screen size.
Explains how Swift 5.7's new 'some' and 'any' keywords solve generic protocol referencing issues, improving code abstraction.
Explains how to use iOS 16's new UIHostingConfiguration to embed SwiftUI views within UITableView and UICollectionView cells.
The creator of Swift by Sundell reflects on the website's five-year anniversary, its growth, and future plans for content and the podcast.
Explains Swift 5.6's type placeholders, a feature that simplifies generic type declarations by letting the compiler infer certain types.
Explains abstract types and methods in Swift, comparing abstract base classes with protocol-oriented approaches for defining shared interfaces.
Explains how Swift implements equality using the Equatable protocol, covering value vs. reference types, automatic synthesis, and conditional conformance.
Explores strategies for writing unit-testable code within SwiftUI views, separating UI logic from business logic for better verification.
Explains how to combine Swift protocols using inheritance and type-constrained extensions for flexible, reusable code.
Explains how to implement automatic retry logic for asynchronous operations in Swift using the new concurrency model, as a replacement for Combine's retry operator.
A guide to using for loops, forEach, and while loops in Swift for iterating over collections, with examples and key differences.
A guide to creating Combine-compatible wrappers for async/await APIs in Swift, enabling integration between different concurrency models.
Explains two Swift techniques for capturing 'self' strongly within escaping closures, including explicit 'self' keyword and capture lists.
A tutorial on creating a reusable AsyncButton in SwiftUI to handle asynchronous actions and prevent duplicate calls.
Explains how to add delays to Swift Tasks using Task.sleep, with examples and a custom delayed task abstraction.