case toggle(UUID) } let toDoReducer = Reducer<ToDoState,ToDoAction,ToDoEnvironment> { state, action, environment in switch action { case .append: state.tasks += [Task(title: "Ճ", done: false)] return .none case let .toggle(id): state.tasks = state.tasks.map { task in guard task.id == id else { return task } var newTask = task newTask.done = !newTask.done return newTask } return .none } } struct ToDoState : Equatable { var tasks: [Task] = [] var completed: [Task] { get{ return tasks.filter { $0.done } } } var unCompleted: [Task] { get{ return tasks.filter { !$0.done } } } } class Tasks :ObservableObject { @Published var tasks: [Task] = [] var completed: [Task] { get{ return tasks.filter { $0.done } } } var unCompleted: [Task] { get{ return tasks.filter { !$0.done } } } func append(title: String){ tasks.append(Task(title: title, done: false)) } func toggle(id: UUID){ tasks = tasks.map { task in guard task.id == id else { return task } var newTask = task newTask.done = !newTask.done return newTask } } } 5$"ؔܕ 0CTFSWBCMF0CKFDU001 ঢ়گΈʹԠ͍͚͕ͯ͡Ͱ͖Δ