From fdb4633d3e9158e457d57e820df6e1efb4df39c2 Mon Sep 17 00:00:00 2001 From: Ruben Beltran del Rio Date: Sun, 7 May 2023 15:22:54 +0200 Subject: Update to support notes + new style --- Map/Data/Store.swift | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Map/Data/Store.swift (limited to 'Map/Data/Store.swift') diff --git a/Map/Data/Store.swift b/Map/Data/Store.swift new file mode 100644 index 0000000..7860f33 --- /dev/null +++ b/Map/Data/Store.swift @@ -0,0 +1,18 @@ +import Foundation + +final class Store: ObservableObject { + @Published private(set) var state: State + + private let reducer: Reducer + + init(initialState: State, reducer: @escaping Reducer) { + self.state = initialState + self.reducer = reducer + } + + func send(_ action: Action) { + reducer(&state, action) + } +} + +typealias Reducer = (inout State, Action) -> Void -- cgit