After clonning repository run carthage bootstrap --platform iOS
in its root directory to install dependencies. The only dependency used is R.swift. It's used to generate various resource identifiers, i.e. for table view cell's reuse identifiers and xib files, to make working with them compile-time type-safe and free of stringly-typing.
Code is broken into 3 high level layers:
- domain layer, contains domain models and services for data queries
- data access layer, contains concrete implementations of interfaces, used by services for data access i.e. via network or using in-memory cache
- application, contains all UI related components, broken by user stories
Similar structure is used to organise unit tests suite. Code is written with dependency injection in mind to allow easy unit testing. Constructor injection is used for plain objects and property injection is mostly used for view controllers as the app is also using storyboards.
Application layer is broken by user stories each of which contains of set of similar components:
- UI components: cells and lists view controller
- view models: cell view models map domain objects to their presentation models, lists view controller models store the state of the lists and map data (arrays of domain objects) to arrays of cells view models
- data providers: access services and constructs updated view models for lists
- flow controller: manages navigation and data flow inside user story, making individual screens decoupled from each other
Support for dynamic fonts is implemented using approach that I've described in this article. This approach allows automatic updates of labels' fonts on trait collections and content size category changes.
Simple helper is used to provide context-aware segue-execution, similar to SegueManager. This allows to simplify passing data between screens when segues are used.
Naive implementation of in-memory cache is provided, based on decorators for API repositories.