Pet project for study usage of Redux State Containerwith Combine and Swift UI. Contains simple examples of network/database abstract layer, abstract state container layer (and one implementation) and some views.
- Combine;
- SwiftUI;
- Realm;
- Swinject;
MVVM - is the main Architecture for the project. In this project, we use a combination of View, ViewModel, Entity, Router (and Routes), and additional Builder.
View - View and must contain only UI components and UI actions
ViewModel - Manager of incomed data from View and Redux state-container. Contains state-container protocol and Router. Control all business logic and data request.
Entity - JSON/UI models, which mirror database models.
Router - Navigation Layer controller. Control and provide all navigation (modal, push-transitions) to another views and provide generated subviews. Don't use it for presenting alerts, pickers and action sheets.
Builder - Class for 'build' view. Contains all inits for view and it's components (ViewModel, Router, Entity). Can be used to build one view with different styles or with different init preconditions
Project structure presenter with next main modules:
All graphic interface elements that are or will be used on more than one screen should be placed in this folder in the section corresponding to their type.
All swift/obj-c extensions should be placed in this folder in the section corresponding to their type.
All .assets files, colors, fonts and graphic information files should be placed in this folder in the section corresponding to their type.
This folder contains next types:
- all .plist files
- Constants
- AppDelegate/SceneDelegate
- Dependencies Holder/Injector. For more info about DI
All Views and their support files should be places in this folder. Each View must have their own folder, which contains all it's support files, like Builder, ViewModel, Router and others. This folder must have the same name as placed into it's View.
Folder contains 3 main sub-folders:
- Network Provider
- contain all network Providers and their Protocolos, grouped by their type.
- Network Models
- contain JSON models for decode/encode them for API.
- all models must be grouped by their type and logic mission (for send and response).
- you can use entities from this folder for View.
- Network Service
- contain main Abstract network service inpered by Moya
Foler contains 2 main sub-folders:
- Base Services
- contains an abstraction layer for work with redux state container (Store, AppState, ServiceContainer) and AppAction enum.
- Protocols
- contains an implementation of Store layer. Should have different implementations for each logic block (depends on your project's business logic, in this project - exist only one block: work with Photo Entity).
Folder contains 3 main sub-folders:
- Providers
- contain all database Providers and their Protocolos, grouped by their type.
- Realm Models
- contain Realm(database) models for communicate only with database
- Realm models mustn't communicate with View, use special DomainConvertibleType type for 'decorate' datamodels into UI-friendly models, for more details go here
- Database Service
- contain main Abstract database service for Realm Database, for more details go here also contain base models and serivces for database (MigrationService and Error's models)
cd <root folder>
pod install