forked from cx-org/CombineX
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request cx-org#97 from cx-org/xcode12
Implement remaining new interface from Xcode12
- Loading branch information
Showing
10 changed files
with
422 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#if canImport(Combine) | ||
|
||
import Combine | ||
|
||
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) | ||
extension Publisher where Output: Publisher, Output.Failure == Never { | ||
|
||
@available(macOS, obsoleted: 11.0) | ||
@available(iOS, obsoleted: 14.0) | ||
@available(tvOS, obsoleted: 14.0) | ||
@available(watchOS, obsoleted: 7.0) | ||
public func switchToLatest() -> Publishers.SwitchToLatest<Publishers.SetFailureType<Output, Failure>, Publishers.Map<Self, Publishers.SetFailureType<Output, Failure>>> { | ||
return map { $0.setFailureType(to: Failure.self) } | ||
.switchToLatest() | ||
} | ||
} | ||
|
||
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) | ||
extension Publisher where Failure == Never, Output: Publisher { | ||
|
||
@available(macOS, obsoleted: 11.0) | ||
@available(iOS, obsoleted: 14.0) | ||
@available(tvOS, obsoleted: 14.0) | ||
@available(watchOS, obsoleted: 7.0) | ||
public func switchToLatest() -> Publishers.SwitchToLatest<Output, Publishers.SetFailureType<Self, Output.Failure>> { | ||
return setFailureType(to: Output.Failure.self) | ||
.switchToLatest() | ||
} | ||
} | ||
|
||
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) | ||
extension Publisher where Failure == Never, Output: Publisher, Output.Failure == Never { | ||
|
||
@available(macOS, obsoleted: 11.0) | ||
@available(iOS, obsoleted: 14.0) | ||
@available(tvOS, obsoleted: 14.0) | ||
@available(watchOS, obsoleted: 7.0) | ||
public func switchToLatest() -> Publishers.SwitchToLatest<Output, Self> { | ||
return .init(upstream: self) | ||
} | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.