Full-screen video feed playing app.
This app reads a JSON file from the local storage. Then it plays the videos from the URLs provided on the JSON file. This is a full-screen video-playing app. Infinite scrolling is done by injecting the same resources but modifying the property of the corresponding model.
- All the videos are a lot longer than they should be. As a result, the initial video loading/buffering is a bit slow.
- The videos do not have the best resolution suitable for iPhone.
- Returning to the app from the background is not yet handled.
There is a total of 6 targets on the project.
- Feed is a framework focused on responsibility which requires no view part.
- FeedTests is used to unit test Feed.
- FeediOS is a framework that handles the responsibility which requires the view part
- FeediOSTests is used to unit test FeediOS.
- FeedPlayer is the composition part. This is the iOS app that runs on the simulator.
- FeedPlayerTests is used to unit test FeedPlayer
There is only one cell is visible at a time on the device.
- A video is played only when the cell is visible.
- Once the cell is not in the visible state immediately the video is paused
- Also, the video player is set to nil to save space and smoothness on the app
- On
prepareForReuse
the texts are set to nil. - Request for more data/feed is called through pre-fetch API of the table-view.
All over the app, the dependency is abstracted mostly by protocol. An example can be the UniqueFeedGenerator
protocol. The UniqueFeedGenerator
provides the interface for generating unique feeds. FeedGenerator
implements this protocol for providing consistent unique feeds. However, this is not an idea for test purpose. Because we need to compare feeds on testing. So on the FeedTests, we use NonUniqueFeedGenerator
which implements the UniqueFeedGenerator
but underneath the NonUniqueFeedGenerator
was providing the same feed which makes it easier to compare feed on the test environment.
Also, we use the Mapper object to map the real model with the test model. Because on the test there might be some confirmation of some protocol which might not necessary for production code. An example can be the confirmation of Equatable
protocol. The production code models don't need to confirm the Equatable
protocol, it is a test-only requirement. So we use FeedModelMapper
, which confirms Equatable
, which maps the production model FeedModel
into the test environment.
We use Spy based test doubles to track different messages on testing time. Such a spy(test double) is FeedClientSpy
, which captures each of the messages when a call is being made or some behavior is being injected into the Client.