Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mkj-is/elementaryeffectbuilder

Experimental, uni-directional and purely functional effect builder in Swift.
https://github.com/mkj-is/elementaryeffectbuilder

effects elm function-builder function-composition redux-sagas swift unidirectional-data-flow

Last synced: about 1 month ago
JSON representation

Experimental, uni-directional and purely functional effect builder in Swift.

Awesome Lists containing this project

README

        

# ElementaryEffectBuilder

[**Elementary**](https://github.com/mkj-is/Elementary) uni-directional architecture extension in Swift. This package function builder for creating and combining effects.
It is inspired by Redux sagas.

## Installation

When using Swift package manager install using Xcode 11+ or add following line to your dependencies:

```swift
.package(url: "https://github.com/mkj-is/ElementaryEffectBuilder.git", from: "0.1.0")
```

## Usage

Main feature of this package is combining effects function into one:

```swift
let appEffect: Effect = buildEffect {
createNetworkEffect()
createPersistenceEffect()
createUrlEffect()
}
```

Also `take` functions for building effects are provided.
See the following example:

```swift
func createUrlEffect(application: UIApplication = .shared) -> Effect {
take(
AppAction.openHomepage,
execute: { application.open(URL(string: "https://mkj.is")!) }
)
}
```

## Contributing

All contributions are welcome.

Project was created by [Matěj Kašpar Jirásek](https://github.com/mkj-is).

Project is licensed under [MIT license](LICENSE.txt).