Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Solution
Overview
This PR introduces the solution for TakeHome.
Including
BirdListViewController
for displaying a list of birds and aBirdDetailViewController
for detailed bird information. Users can select a bird to view its details, see community notes, and add new notes. The implementation follows a clean architecture approach, utilizing a ViewModel to manage business logic and data binding.Video
Simulator.20Screen.20Recording.20-.20iPhone.2015.20Pro.20Max.20-.202024-08-13.20at.2022.mp4
Architecture Overview
The implementation follows a clean architecture approach, which separates concerns into distinct layers, promoting testability, maintainability, and scalability. The key architectural components involved are the ViewControllers, ViewModel, and Use Cases.
1. ViewControllers
BirdListViewController:
ViewModel
.ViewModel
.BirdDetailViewController:
ViewModel
.2. ViewModel
ViewModel
acts as the Presenter or Controller in the architecture, acting as an intermediary between theViewControllers
and the domain layer (use cases).ViewControllers
are updated automatically.ViewControllers
.3. Use Cases
LoadBirdsUseCase:
ViewModel
, making the business logic easy to test and modify.AddNoteUseCase:
ViewModel
, ensuring a clear separation of concerns.4. Data Binding and Reactive Updates
ViewModel
to publish changes to theViewControllers
in a reactive manner.Summary
This architecture provides a clear separation of concerns:
This approach ensures a modular, maintainable, and scalable codebase, making it easier to add new features, test existing functionality, and maintain the code over time.