diff --git a/Sources/SimplexArchitecture/StateContainer.swift b/Sources/SimplexArchitecture/StateContainer.swift index 6a71187..9e6595f 100644 --- a/Sources/SimplexArchitecture/StateContainer.swift +++ b/Sources/SimplexArchitecture/StateContainer.swift @@ -1,8 +1,7 @@ import Foundation import XCTestDynamicOverlay -/// StateContainer is not thread-safe. Therefore, StateContainer must use NSLock or NSRecursiveLock for exclusions when changing values. -/// In Store, NSRecursiveLock is used for exclusions when executing the `reduce(into:action)`. +/// StateContainer is not thread-safe. StateContainer must be accessed from MainActor. @dynamicMemberLookup public final class StateContainer { public var reducerState: Target.Reducer.ReducerState { diff --git a/Sources/SimplexArchitecture/Store/Store+send.swift b/Sources/SimplexArchitecture/Store/Store+send.swift index e64a23e..fd8f234 100644 --- a/Sources/SimplexArchitecture/Store/Store+send.swift +++ b/Sources/SimplexArchitecture/Store/Store+send.swift @@ -118,13 +118,6 @@ extension Store { } } - @inlinable - func withLock(_ operation: () throws -> T) rethrows -> T { - lock.lock() - defer { lock.unlock() } - return try operation() - } - func makeSend(for container: StateContainer) -> Send { Send( sendAction: { [weak self] action in diff --git a/Sources/SimplexArchitecture/Store/Store.swift b/Sources/SimplexArchitecture/Store/Store.swift index 01b718b..04217f6 100644 --- a/Sources/SimplexArchitecture/Store/Store.swift +++ b/Sources/SimplexArchitecture/Store/Store.swift @@ -16,7 +16,6 @@ public final class Store { // Buffer to store Actions recurrently invoked through SideEffect in a single Action sent from View @TestOnly var sentFromEffectActions: [ActionTransition] = [] - @usableFromInline let lock = NSRecursiveLock() @usableFromInline var pullbackAction: ((Reducer.Action) -> Void)? @usableFromInline var pullbackReducerAction: ((Reducer.ReducerAction) -> Void)?