Skip to content

Commit

Permalink
Improve ProxyPublisher init
Browse files Browse the repository at this point in the history
  • Loading branch information
Alkenso committed Oct 26, 2023
1 parent a2dd44e commit 7e3b08e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@

import Combine

@available(macOS 10.15, iOS 13, tvOS 13.0, watchOS 6.0, *)
extension Publisher {
public func eraseToAnyPublisher(attachingContext context: Any?) -> AnyPublisher<Output, Failure> {
ProxyPublisher(self, context: context).eraseToAnyPublisher()
}
}

@available(macOS 10.15, iOS 13, tvOS 13.0, watchOS 6.0, *)
extension Publisher where Output: Equatable, Failure == Never {
/// Publishes value changes in order it receives the values
Expand Down
2 changes: 1 addition & 1 deletion Sources/SpellbookFoundation/Combine/Proxies.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public struct ProxyPublisher<P: Publisher>: Publisher {
public let proxy: P
public var context: Any?

public init(_ publisher: P) {
public init(_ publisher: P, context: Any? = nil) {
proxy = publisher
}

Expand Down

0 comments on commit 7e3b08e

Please sign in to comment.