FeedStore
challenge - iOSLeadEssentials.com
The
You are called to build a new infrastructure component that conforms to the <FeedStore>
protocol using Core Data to persist the feed.
Instructions
-
Fork the latest version of this repository. Here's how forking works.
-
Open the
FeedStoreChallenge.xcodeproj
project on Xcode 12.4 (you can use other Xcode versions by switching to the appropriate branch, e.g.,xcode11
,xcode12
,xcode12_2
,xcode12_3
).-
Do not change the indentation in the project.
-
Do not rename the existing classes and files.
-
Important: Every time you build the project, it'll automatically reformat the modified files with SwiftFormat to maintain the code consistent.
-
-
Implement a
<FeedStore>
protocol implementation using Core Data in theCoreDataFeedStore.swift
file.-
There shouldn't be any extra logic in the
CoreDataFeedStore
implementation.-
It should just obey to the retrieve/insert/delete commands without any extra logic.
-
For example, don't check if the array of images is empty - and don't replace optional values with default values such as
Date()
. -
This kind of logic shouldn't be in the infrastructure store implementation.
-
-
-
We already provided the Core Data boilerplate and the tests.
-
-
Use the
Tests/FeedStoreChallengeTests.swift
to validate your implementation conforms to the store specs.-
Uncomment (CMD+/) and implement one test at a time following the TDD process:
- Make the test pass, commit, and move to the next one.
-
While developing your solutions, run all tests with CMD+U.
-
-
Use the
Tests/FeedStoreIntegrationTests.swift
to validate that your implementation persists data to disk correctly.- Uncomment and implement one integration test at a time following the TDD process: Make the test pass, commit, and move to the next one.
-
Errors should be handled accordingly.
-
There shouldn't be any force-unwrap
!
orfatalError
in production code. -
There shouldn't be empty
catch
blocks. -
There shouldn't be any
print
statements, such asprint(error)
.
-
-
When all tests are passing and you're done implementing your solution:
-
Create a Pull Request from your branch to the main challenge repo's matching branch.
- For example, if you implemented the challenge using the
xcode12_4
branch, your PR should be from your fork'sxcode12_4
branch into the main repo'sxcode12_4
branch (DO NOT MIX Xcode versions or you'll have merge conflicts!).
- For example, if you implemented the challenge using the
-
The title of the Pull Request should be: Your Name - Feed Store Challenge.
-
-
Review your code in the Pull Request (PR) and make sure it follows all the instructions above.
- If it doesn't, make the appropriate changes, push, and review your code in the PR again.
-
After you review your code and it follows all the instructions above:
- Post a comment in the challenge page in the academy with the link to your PR, so we can review your solution and provide feedback.
Guidelines
-
Aim to commit your changes every time you add/alter the behavior of your system or refactor your code.
-
Aim for descriptive commit messages that clarify the intent of your contribution which will help other developers understand your train of thought and purpose of changes.
-
The system should always be in a green state, meaning that in each commit all tests should be passing.
-
The project should build without warnings.
-
The code should be carefully organized and easy to read (e.g. indentation must be consistent).
-
Make careful and proper use of access control, marking as
private
any implementation details that aren’t referenced from other external components. -
Aim to write self-documenting code by providing context and detail when naming your components, avoiding explanations in comments.
-
Aim to declare dependencies explicitly, leveraging dependency injection wherever necessary.
-
Aim not to block the main thread - run expensive operations in a background queue.
Happy coding!