Skip to content

congncif/FIDataFlowArchitectureNew

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FIDataFlowArchitecture

[![CI Status](http://img.shields.io/travis/NGUYEN CHI CONG/FIDataFlowArchitecture.svg?style=flat)](https://travis-ci.org/NGUYEN CHI CONG/FIDataFlowArchitecture) Version License Platform

FIDataFlow sequence

Getting started

A Flow is a task, it start from fetching data, transforming data & finally refreshing UI if needed. In FIDataFlow, a IntegrateController will hold processing & start a serial flows. IntegrateController include LogicController for fetching data, pre-processing data and DataController for transforming data, that is sent from LogicController.
When a flow is started, these blocks of IntegrateController are performed:

  • start:
  • next:
  • end:
  • error:
  • completion:

(See more in code comments)>

To implement your flow, custom Logic&Data Controller.

  • to fetch data, override method:
    prepareSignalWithParameters:completion:compeltion
  • to transform data, override method:
    tranformDataIfNeed:error:
    By default, base logic controller will pre-process data & data controller will transform data to FIBaseModel (based from JSONModel) If your returned data is kind of JSON, you only define return model as FIBaseModel & override this method of DataController like:

`- (NSString*)classNameForReturnData{ return @"YourJSONModelClassName"; }`

Magically, you will receive return data as an object of your model class.

##For advanced: setup runningType for IntegrateController

  • FIFlowRunningTypeDefault: start asynchronous
  • FIFlowRunningTypeOnly: start only flow, wait finish to start new flow
  • FIFlowRunningTypeLastest: start serial flows, lastest flow will be started
  • FIFlowRunningTypeQueue: start serial flows, before started all flows are added to queue & start flow by flow, finish previous flow -> start next flow


More features: multiple logics in FIIntegrateController, transform data, .... -> Contact me!

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

FIDataFlowArchitecture is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "FIDataFlowArchitectureNew"

Author

NGUYEN CHI CONG, congnc.if@gmail.com

License

FIDataFlowArchitecture is available under the MIT license. See the LICENSE file for more info.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published