Skip to content

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

License

Notifications You must be signed in to change notification settings

ra1028/SwiftUI-Flux

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 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.

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages