Swiftpack.co - clmntcrl/swidux-watchmen as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by clmntcrl.
clmntcrl/swidux-watchmen 0.2.0
Middleware for action side effects in Swidux using “Watchmen“ 🙂
⭐️ 0
🕓 5 years ago
.package(url: "https://github.com/clmntcrl/swidux-watchmen.git", from: "0.2.0")

🙂 SwiduxWatchmen

Middleware for action side effects in Swidux using “Watchmen“ 🙂

Usage

Create a Watchmen that could react to some actions to handle side effects and then dispatch other actions.

let doomsdayClockWatchmen = Watchmen { action in
    switch action {
    case DoomsdayClockAction.fetchDoomsdayClock:
        fetchDoomsdayClock {
            store.dispatch(DoomsdayClockAction.fetchDoomsdayClockSuccess(clock: $0))
        }
    default: break
    }
}

Add your watchmen to your Store middlewares.

import Swidux
import SwiduxWatchmen

let store = Store<AppState>(
    initialState: AppState(),
    reducer: reducer,
    middlewares: [
        .create(combiningWatchmen: [ doomsdayClockWatchmen ]),
    ]
)

Installation

Carthage

Add the following dependency to your Cartfile:

github "clmntcrl/swidux-watchmen" ~> 0.2

CocoaPods

Add the following pod to your Podfile:

pod 'SwiduxWatchmen', '~> 0.2'

SwiftPM

Add the package as dependency in your Package.swift:

dependencies: [
    .package(url: "https://github.com/clmntcrl/swidux-watchmen.git", from: "0.2.0"),
]

License

SwiduxWatchmen is released under the MIT license. See LICENSE for details.

GitHub

link
Stars: 0
Last commit: 5 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Dependencies

Release Notes

0.2.0
5 years ago
  • Use Swidux 1.0.0 and its new middleware architecture
  • Support package managers:
    • Carthage
    • CocoaPods
    • SwiftPM

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics