BentoBear is a small project which downloads, caches, saves and displays a list of placeholder posts. It has two screens: the list of posts and a post detail screen. The goal was to become familiar with ReactiveSwift, ReactiveFeedback, Bento and BentoKit (see below). This is my first experience using all of these particular libraries, although I have several years of FRP under my belt with RxSwift (still, its API is considerably different from ReactiveSwift).
It is far from perfect, but I feel that at this point I've hit the point of diminishing returns. It is worthy of discussion, as many decisions may have been made in a different way, and a lot could be done differently. I have my reasons for most of it which I am ready to talk about at length :)
The codebase is mostly testable already thanks to the chosen architecture, but if we were really talking about production grade, some of the runtime classes could be further decomposed to get parameters injected, so that they could be fully tested. There are also just a few small steps left to make the app fully runtime-mockable, which means consistent, repeatable UI tests independent of network or local storage. This is my pet peeve.
- Uses Bento.
- Uses BentoKit and StyleSheets from the same repo.
- Uses ReactiveFeedback.
- Fully localized with plurals support.
- Persistence to local storage with in-memory cache.
- Testable components with protocols, somewhat tested.
- SOLID.
- Dependency injection.
- Testable and tested (a little bit).
- Error handling and easily adding new errors.
- Architected for future change.
- Consitent coding style.
- Clean project structure, no cruft.
- Local persistence (with
UserDefaults
to avoid using external libraries). - Download all data, though only visible fields are used.
- “Production grade” code – mostly.
- Point of synchronization with downloading and saving data.
- @ilyapuchka for his post which inspired this project (though I had to figure out a few operators and classes by myself).
- @peres for being very accessible and the sample Flow implementation.
- @sergdort for help with Bento and ReactiveSwift.