How essentialdevelopercom/essential-feed-case-study works
Main components
• UI Layer (Client Application): This is in EssentialApp (and Prototype) where the app delegate, scene delegate, storyboards, view controllers, table view/cell management, and asset catalogs live. It also includes components like FeedImageCell, FeedViewController, and Controllers in EssentialFeediOS.
• Presentation Layer: Presenters such as FeedPresenter, FeedImagePresenter, and LoadResourcePresenter exist to transform domain models into view models. Also include any localization and error UI components.
• Domain / Use Case Layer: Encapsulates the use cases (load feed from remote, load feed from cache, validate cache, save feed, load image data, etc.) as described in the README. This represents the core business logic.
• Networking / API Layer: Contains the “Feed API”, “Image Comments API,” HTTP clients (like URLSessionHTTPClient), endpoint definition files, data mappers, and payload contracts for both feed items and image comments.
• Cache / Persistence Layer: Shows components for caching the feed – both using Core Data (CoreDataFeedStore, ManagedCache, ManagedFeedImage) and an InMemory option for testing. It also includes cache validation, expiry logic, and saving/deleting mechanisms.
• Shared Modules/Infrastructure: Includes shared API Infra (HTTPClient protocols), shared presentation (error, loading, and resource view models), and standard helper components. This covers helper classes for testing, extensions, and common utilities.
• That the Use Case Layer (Domain) first attempts to load data from the Remote API via the Networking Layer. In parallel, note the feed caching operations where the Domain asks the Persistence Layer to either retrieve or save feed data.
• Error paths (e.g., no connectivity, invalid data) flowing from the API Layer back to the Presentation Layer and then displayed through the UI.
• For image comments, create a similar flow chain: UI (when a user requests comments) to the Image Comments API, mapping, and then to a presenter and view.
• Optionally, represent integration test frameworks and CI workflows as separate but interacting “modules” ensuring quality assurance.
Architectural patterns and design principles
• The separation of concerns: clearly differentiating between UI, presentation/business logic, networking, and caching layers.
• Client-Server architecture for remote feed loading and REST API integration.
• Incorporation of a Clean Architecture/MVC/MVP-like flow, where the responsibilities for presentation, domain logic, and data handling are kept separate.
Technologies, frameworks, and libraries
• Xcode for project configuration.
• Swift as the programming language.
• Core Data (and an InMemory alternative) for caching.
• URLSession-based networking for remote requests.
• Storyboards and Swift UI components for the UI.
• GitHub Actions for Continuous Integration and Deployment.
• Testing frameworks (integration, acceptance, snapshot tests) are spread across the EssentialAppTests, EssentialFeedTests, and EssentialFeediOSTests directories.