Skip to content
🚀 This is a tiny experimental application using SwiftUI with Flux architecture.
Branch: master
Clone or download
Latest commit 5b72fef Jun 6, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
SwiftUI-Flux.xcodeproj Initial commit Jun 6, 2019
SwiftUI-Flux Initial commit Jun 6, 2019
assets Initial commit Jun 6, 2019
.gitignore Initial commit Jun 6, 2019
LICENSE Initial commit Jun 6, 2019
README.md Initial commit Jun 6, 2019

README.md

🚀 SwiftUI-Flux

This is a tiny experimental application using SwiftUI with Flux architecture.

struct CounterView : View {
    enum Action {
        case increment
        case decrement
    }

    @State var store = Store<Int, Action>(initial: 0) { count, action in
        switch action {
        case .increment:
            return count + 1

        case .decrement:
            return max(0, count - 1)
        }
    }

    var body: some View {
        VStack {
            Text("\(store.state)")

            HStack {
                Button(action: { self.store.dispatch(action: .decrement) }) {
                    Text("Decrement")
                }

                Button(action: { self.store.dispatch(action: .increment) }) {
                    Text("Increment")
                }
            }
        }
    }
}

📋 Requirements

  • Swift5.1 Beta
  • Xcode11.0 Beta
  • iOS 13.0 Beta

📝 License

SwiftUI-Flux is released under the MIT License.

You can’t perform that action at this time.