diff --git a/Sources/Atomic.swift b/Sources/Atomic.swift index e5db19d..d7453c1 100644 --- a/Sources/Atomic.swift +++ b/Sources/Atomic.swift @@ -69,8 +69,9 @@ final class Atomic { @discardableResult func modify(action: (Value) throws -> Value) rethrows -> Value { return try withValue { value in + let oldValue = value _value = try action(value) - return value + return oldValue } }