Swiftpack.co -  horsejockey/PureStateMachine-Swift as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
horsejockey/PureStateMachine-Swift
A simple pure state machine
.package(url: "https://github.com/horsejockey/PureStateMachine-Swift.git", from: "1.0.0")

PureStateMachine

A simple pure state machine extracted from this repo by @rob-brown to separate out the Actor Model from the state machine. Additionaly it adds SPM support.

Based on Elm architecture and https://gist.github.com/andymatuschak/d5f0a8730ad601bcccae97e8398e25b2

Rob Brown's Actor + PureStateMachine: https://github.com/rob-brown/Actor

Actor Model only fork with SPM support: https://github.com/horsejockey/Actor-Swift

Architecture

This implementation of a state machine is composed of a container of the current state and an event handler. The event handler recieves an event and based on the current state and that event it can choose to update it's current state, emit commands or side effects, do neither, or a combinaton of the two.

+-----------------+
|                 |
|  State Machine  |            +-------+
|                 +<-----------+ Event +------------+
|                 |            +-------+
|                 |
|                 |            +-------+
|                 |       +----+ State +------------>
|                 |       |    +-------+
| +-------------+ |       |
| |    State    | |       |    +------------------+
| |             | +------------+ State & Commands +->
| +-------------+ |       |    +------------------+
+-----------------+       |
                          |    +----------+
                          +----  Commands +--------->
                          |    +----------+
                          |
                          |    +-----------+
                          +----+ No Update +-------->
                               +-----------+

GitHub

link
Stars: 1
Last commit: 22 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

1.0.0
23 weeks ago

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