ivfomenko / unsplashapp

Pet project for study usage of Redux State Container with Combine and Swift UI.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Redux app based on unspalsh api

About

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.


Main project Technology

  • Combine;
  • SwiftUI;
  • Realm;
  • Swinject;

Project architecture

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

Project structure presenter with next main modules:

Components

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.

Extensions

All swift/obj-c extensions should be placed in this folder in the section corresponding to their type.

Themes

All .assets files, colors, fonts and graphic information files should be placed in this folder in the section corresponding to their type.

Support Filles

This folder contains next types:

  • all .plist files
  • Constants
  • AppDelegate/SceneDelegate
  • Dependencies Holder/Injector. For more info about DI
Flow

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.

Network

Folder contains 3 main sub-folders:

  1. Network Provider
    • contain all network Providers and their Protocolos, grouped by their type.
  2. 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.
  3. Network Service
    • contain main Abstract network service inpered by Moya

State Container

Foler contains 2 main sub-folders:

  1. Base Services
    • contains an abstraction layer for work with redux state container (Store, AppState, ServiceContainer) and AppAction enum.
  2. 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).
Database

Folder contains 3 main sub-folders:

  1. Providers
    • contain all database Providers and their Protocolos, grouped by their type.
  2. 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
  3. 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)

Deployment

cd <root folder> pod install


About

Pet project for study usage of Redux State Container with Combine and Swift UI.


Languages

Language:Swift 99.7%Language:Ruby 0.3%