diff --git a/GRDB/Utils/KeyPathRefining.swift b/GRDB/Utils/KeyPathRefining.swift index beda0ab41..36639f80a 100644 --- a/GRDB/Utils/KeyPathRefining.swift +++ b/GRDB/Utils/KeyPathRefining.swift @@ -20,6 +20,15 @@ extension KeyPathRefining { return result } + #if compiler(<5.1) + @inlinable + func with(_ keyPath: WritableKeyPath, _ value: T) -> Self { + var result = self + result[keyPath: keyPath] = value + return result + } + #endif + @inlinable func map(_ keyPath: WritableKeyPath, _ transform: (T) throws -> T) rethrows -> Self { var result = self