Applying the Decorator Pattern in SwiftUI to Add Caching Without Changing Existing CodeMay 2, 2026·7 min read
Test-Driving a Cache Layer in SwiftUI In previous articles, we built a CachingFeedRepository by writing the implementation first and tests after. That works — but it leaves a subtle gap: the tests are shaped by the implementation you alreJun 22, 2026·8 min read
SwiftUI - Decoupling ModelsProblem: How can we avoid breaking an entire app when a model changes? Solution: Decouple each model based on their specific domain. A Deeper Dive When working with data from various sources, a common challenge developers face is the potential for e...Sep 13, 2023·9 min read
SwiftUI - TDD actor to avoid race conditionProblem: How to avoid threading race conditions in your class? Solution: Use actor that handles all the concurrency for you! Code that runs synchronously is easy to manage and understandBut when start introducing threads, problems occurYou need to ma...Jan 12, 2023·4 min read
SwiftUI - TDD async/awaitProblem: How to TDD async/await ? Solution: Stub the response, async function needs to know it's result before call IMPORTANT: This tutorial is only available for iOS 15+It will use the async/await integration in URLSessionAnd the AsyncImage SwiftUI ...Oct 13, 2022·17 min read
SwiftUI - Extract navigation logic from SwiftUI views for testabilityProblem: How to test your navigation logic in SwiftUI ? Solution: Extract navigation logic in a separate Service that handles it using UIKit SwiftUI is very powerful tool, for UI creation and animationBut I really don't like the navigation logicThat ...Jun 21, 2022·20 min read
SwiftUI - Test drive the logic inside a view using TDDProblem: How test behavior inside a SwiftUI view ? Solution: Extract all the logic in a ViewModel and test drive only the behaviour using the TDD process ! You have this view to integrate Specs for this design look like this: - [ ] Display favor...May 30, 2022·16 min read
SwiftUI - Automate UI regressionProblem: How to automate regression on UI screens? Solution: Snapshot Tests ! SwiftUI and the Live Preview are a good matchThanks to them I was able to quickly build this view: The Live Preview is effective for creating viewsBut does not warn in cas...Apr 21, 2022·4 min read