Swiftpack.co - mkj-is/ElementaryCombine as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by mkj-is.
mkj-is/ElementaryCombine 0.1.0
Experimental, uni-directional and purely functional architecture for SwiftUI.
⭐️ 4
🕓 3 years ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/mkj-is/ElementaryCombine.git", from: "0.1.0")

ElementaryCombine

Elementary uni-directional architecture extension. This package provides ObservableStore which can be easily used in SwiftUI apps (but not exclusively).

Installation

When using Swift package manager install using Xcode 11+ or add following line to your dependencies:

.package(url: "https://github.com/mkj-is/ElementaryCombine.git", from: "0.1.0")

Usage

The ObservableStore builds on top of Elementary Store and adds conformance to ObservableObject in Combine. Due to this fact it can ve easily connected to SwiftUI views. See the following example of incrementing counter:

struct RootView: View {
    @ObservedObject var store = ObservableStore(state: 0, update: updateCounter)

    var body: some View {
        VStack {
            Text("\(store.state)")
            Button(action: { self.store.dispatch(.increment) }) {
                Text("Increment")
            }
        }
    }
}

Contributing

All contributions are welcome.

Project was created by Matěj Kašpar Jirásek.

Project is licensed under MIT license.

GitHub

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

Dependencies

Release Notes

Let's prototype!
4 years ago

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