struct AppState {
var selectedEvolution: StageType = .general
- var mapBeingDeleted: Map? = nil
}
enum AppAction {
case selectEvolution(evolution: StageType)
case exportMapAsImage(map: Map)
case exportMapAsText(map: Map)
+ case deleteMap(map: Map)
}
func appStateReducer(state: inout AppState, action: AppAction) {
print("Cancel")
}
}
+ case .deleteMap(map: let map):
+ let context = PersistenceController.shared.container.viewContext
+ context.delete(map)
+
+ try? context.save()
}
}