GroupWork is an easy to use Swift framework that helps you orchestrate your concurrent, asynchronous functions in a clean and organized way. This helps make large functions with multiple asynchronous tasks more clear and easy to follow.
complexFunc is a function that returns the result of three asynchronous functions asyncFuncA(), asyncFuncB(), and asyncFuncC(), running concurrently. The completion handler is called only when all these functions have completed. Usage of this library has enabled the above clean interface. This can be scaled to much higher than three asynchronous functions.
notes:
the asynchronous functions should be able to run concurrently without affecting each other
GroupWork is an easy to use Swift framework that helps you orchestrate your concurrent, asynchronous functions in a clean and organized way. This helps make large functions with multiple asynchronous tasks more clear and easy to follow.
Contents
Requirements
Swift 4
Installation
CocoaPods
For CocoaPods, add to
Podfile
:Carthage
For Carthage, add to
Cartfile
:Swift Package Manager
For SPM, add to your package dependencies:
Manually
GroupWork.swift
to the project treeGroupWork.xcodeproj
Documentation
Here
Example Usage
End Goal
complexFunc
is a function that returns the result of three asynchronous functionsasyncFuncA()
,asyncFuncB()
, andasyncFuncC()
, running concurrently. The completion handler is called only when all these functions have completed. Usage of this library has enabled the above clean interface. This can be scaled to much higher than three asynchronous functions.notes:
work.result
is only a simpleBool
Set Up
There is some set up required in order to create
complexFunc()
from above:Now you can create a
GroupWork
, and callwork.simpleFuncA()
on it like in the example.notes:
start()
must be called before an asynchronous taskfinish()
must be called in the completion handler of an asynchronous taskstart()
andfinish()
calls must be balancedWorking Example
The tests have a working example.
License
MIT LICENSE
Authors
Please provide attribution, it is greatly appreciated.