1
1
mirror of https://github.com/danbee/persephone synced 2025-03-04 08:39:11 +00:00
persephone/Persephone/State/Reducers/UIReducer.swift

33 lines
603 B
Swift

//
// UIReducer.swift
// Persephone
//
// Created by Daniel Barber on 2019/5/02.
// Copyright © 2019 Dan Barber. All rights reserved.
//
import ReSwift
func uiReducer(action: Action, state: UIState?) -> UIState {
var state = state ?? UIState()
switch action {
case is MainWindowDidOpenAction:
state.mainWindowOpen = true
case is MainWindowDidCloseAction:
state.mainWindowOpen = false
case is DatabaseUpdateStartedAction:
state.databaseUpdating = true
case is DatabaseUpdateFinishedAction:
state.databaseUpdating = false
default:
break
}
return state
}