Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/cypherpoet/swiftuireduxutils

A collection utilities for architecting SwiftUI apps in the Redux/Elm style of Reducers, Actions, Side Effects and Middlewares. Now updated for Swift Concurrency.
https://github.com/cypherpoet/swiftuireduxutils

redux swift swift-combine-redux swift-data-flow swift-libraries swift-package-manager swift-packages swiftui swiftui-libraries swiftui-redux

Last synced: about 1 month ago
JSON representation

A collection utilities for architecting SwiftUI apps in the Redux/Elm style of Reducers, Actions, Side Effects and Middlewares. Now updated for Swift Concurrency.

Awesome Lists containing this project

README

        

# SwiftUI Redux Utils














Twitter: @cypher_poet

_A collection utilities for architecting SwiftUI apps in the Redux/Elm style of Reducers, Actions, Side Effects and Middlewares._

## Installation

### Xcode Projects

Select `File` -> `Swift Packages` -> `Add Package Dependency` and enter `https://github.com/CypherPoet/SwiftUIReduxUtils`.

### Swift Package Manager Projects

You can add `CypherPoetSwiftUIReduxUtils` as a package dependency in your `Package.swift` file:

```swift
let package = Package(
//...
dependencies: [
.package(
name: "CypherPoetSwiftUIReduxUtils",
url: "https://github.com/CypherPoet/SwiftUIReduxUtils",
.upToNextMinor(from: "0.5.0")
),
],
//...
)
```

From there, refer to the `SwiftUIReduxUtils` "product" delivered by the `CypherPoetSwiftUIReduxUtils` "package" inside of any of your project's target dependencies:

```swift
targets: [
.target(
name: "YourLibrary",
dependencies: [
.product(
name: "SwiftUIReduxUtils",
package: "CypherPoetSwiftUIReduxUtils"
),
],
...
),
...
]
```

Then simply `import SwiftUIReduxUtils` wherever you’d like to use it.

## Usage

The goal of these utilities is to serve as _primitives_ for architecting SwiftUI apps in the [Redux](https://redux.js.org/)/[Elm](https://guide.elm-lang.org/architecture/) style of Reducers, Actions, Side Effects and Middlewares.

[Version 0.2.2](https://github.com/CypherPoet/SwiftUIReduxUtils/tree/f9caa47ff8fcd19db61b91737e80183f46050a09/Examples/ExampleApp) had an example application that demonstrated this, but it's no longer functional after `0.3.0`'s concurrency refactor. That said, until I get a new example in place, it could still be useful to look through to some extent.

## Contributing

There aren't many to-dos here at the moment, but feedback and suggestions are certainly not discouraged. Check out some of the [issue templates](./.github/ISSUE_TEMPLATE/) for more info.

## Developing

### Requirements

- Xcode 13.0+

### 📜 Creating & Building Documentation

Documentation is built with [Xcode's DocC](https://developer.apple.com/documentation/docc). See [Apple's guidance on how to build, run, and create DocC content](https://developer.apple.com/documentation/docc/api-reference-syntax).

For now, the best way to view the docs is to open the project in Xcode and run the `Build Documentation` command. At some point in the future, I'm hoping to leverage the tooling the develops for generating/hosting DocC documentation. (Please feel free to let me know if you have any ideas or tooling recommendations around this 🙂).

## Acknowledgments

This project wouldn't be possible without several enlightening projects, articles, and tutorials by others in the Swift community who latched onto using these patterns in SwiftUI. Here are just a few of its main inspirations:

- [Redux-like state container in SwiftUI](https://swiftwithmajid.com/2019/09/18/redux-like-state-container-in-swiftui/) by [@mecid](https://github.com/mecid).
- [Redux-like architecture with SwiftUI](https://danielbernal.co/redux-like-architecture-with-swiftui-basics/) by [@afterxleep](https://github.com/afterxleep).
- [SwiftUI-Redux](https://github.com/kitasuke/SwiftUI-Redux) by [@kitasuke](https://github.com/kitasuke).
- [The Composable Architecture](https://github.com/pointfreeco/swift-composable-architecture)

## License

`CypherPoetSwiftUIReduxUtils` is available under the MIT license. See the [LICENSE file](./LICENSE) for more info.