File tree Expand file tree Collapse file tree
Sources/CombineExtensions/CurrentValuePublisher Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,3 +24,25 @@ extension CurrentValuePublisher {
2424 }
2525
2626}
27+
28+ #if compiler(<6.0)
29+
30+ extension CurrentValuePublisher {
31+
32+ /// Produces a new `CurrentValuePublisher` by extracting a value from the current and all
33+ /// subsequent values using the given key path.
34+ ///
35+ /// This overload is provided for Swift versions prior to 6.0, where key path inference
36+ /// in `map` is not fully supported.
37+ ///
38+ /// - Parameter keyPath: A key path to extract a property of a value.
39+ /// - Returns: A `CurrentValuePublisher` that emits the values extracted by the given key path.
40+ public func map< T> (
41+ _ keyPath: KeyPath < Output , T >
42+ ) -> CurrentValuePublisher < T , Failure > {
43+ self . map { $0 [ keyPath: keyPath] }
44+ }
45+
46+ }
47+
48+ #endif
You can’t perform that action at this time.
0 commit comments