Swift Package Index


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


  • The latest stable release is 0.1.0. Released 11 months ago.
  • The last commit to main was 11 months ago.

Swift Version Compatibility

  • 0.1.0 and main
    5.3
    5.2
    5.1
    5.0
    4.2
Full build results

Platform Compatibility

  • 0.1.0
    iOS
    macOS(Intel)
    macOS(ARM)
    Linux
    tvOS
    watchOS
  • main
    iOS
    macOS(Intel)
    macOS(ARM)
    Linux
    tvOS
    watchOS
Full build results

ElementaryEffectBuilder

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:

.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:

let appEffect: Effect<AppState, AppAction> = buildEffect {
    createNetworkEffect()
    createPersistenceEffect()
    createUrlEffect()
}

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

func createUrlEffect(application: UIApplication = .shared) -> Effect<AppState, AppAction> {
    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.

Project is licensed under MIT license.