Skip to content

Instantly share code, notes, and snippets.

View wickwirew's full-sized avatar

Wes Wickwire wickwirew

View GitHub Profile
@Reducer
struct TodoListFeature {
@ObservableState
struct State {
var todos: IdentifiedArrayOf<TodoFeature.State> = []
var number = 0
}
enum Action: BindableAction {
import SwiftUI
import ComposableArchitecture
@Reducer
struct AppFeature {
@ObservableState
struct State {
var numbers: IdentifiedArrayOf<NumberFeature.State> = [.init(number: 2), .init(number: 3)]
@Presents var form: NumberFeature.State?
var numbersTotal: Int { numbers.reduce(0) { $0 + $1.number } }