A Swift library for building unified feedback loops (state machines) that work with RxSwift, ReactiveSwift, and Combine.
Spin is a Swift library that implements feedback loops, a pattern for building state machines in applications. It solves the problem of managing state consistently across different reactive frameworks (RxSwift, ReactiveSwift, and Combine) and UI technologies (UIKit, AppKit, SwiftUI), especially during transitions like adopting Combine and SwiftUI. By providing a unified syntax, it ensures architectural consistency regardless of the underlying tools.
Swift developers building iOS, macOS, tvOS, or watchOS applications who use or plan to use multiple reactive frameworks (e.g., RxSwift and Combine) or UI technologies (e.g., UIKit and SwiftUI) and need a consistent state management solution.
Developers choose Spin because it offers a single, unified API for feedback loops that works seamlessly with RxSwift, ReactiveSwift, and Combine, eliminating the need to rewrite state management logic when switching frameworks. Its design isolates side effects and promotes pure reducers, making code more predictable and easier to test across mixed codebases.
Spin aims to provide a versatile Feedback Loop implementation working with the three main reactive frameworks available in the Swift community (RxSwift, ReactiveSwift and Combine)
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Spin provides a single API for feedback loops that works with RxSwift, ReactiveSwift, and Combine, as shown in the code examples where the same spin structure is used across different reactive streams.
By confining side effects to feedbacks and keeping reducers as pure functions, Spin promotes predictable and testable state management, a core philosophy emphasized in the README.
Through UISpin and SwiftUISpin wrappers, Spin seamlessly supports UIKit, AppKit, and SwiftUI, allowing consistent state handling across different UI layers, with specific examples for each in the README.
Spin offers multiple dependency injection techniques for feedbacks, including container types, factory functions, and built-in initializers, detailed in the 'What about dependencies in Feedbacks' section.
Developers must install separate packages (SpinRxSwift, SpinReactiveSwift, SpinCombine) depending on the reactive framework, complicating setup and increasing maintenance overhead.
Implementing feedback loops requires understanding state machine theory and reactive programming, which the README acknowledges with extensive explanations, making it less accessible for beginners.
The README points to CHANGELOG.md for information on evolutions and breaking changes, indicating potential instability and the need for frequent updates in long-term projects.