Applying the Decorator Pattern in SwiftUI to Add Caching Without Changing Existing CodeYou've built a clean feed feature. The RemoteFeedRepository fetches items from the network, the LoadFeedUseCase runs the business logic, and the ViewModel drives the view. Everything is tested and worMay 2, 2026·7 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
SwiftUI - Integrate UI without a ready backendProblem: How to integrate UI with a not ready backend? Solution: By decoupling the model returned by the API from the model that manages the UI display ! Simple example with this interface inspired by the Message app: The row that displays a message ...Feb 16, 2022·6 min read