Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combine Interoperability: first iteration #776

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Remove Cancellable conformances.
  • Loading branch information
andersio committed Apr 26, 2020
commit d7b1a5d7d3b8982bffe3f2043157f4def68fe385
26 changes: 3 additions & 23 deletions Sources/CombineInteroperability/Utilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,9 @@ import Combine
extension Lifetime {
@available(macOS 10.15, iOS 13.0, tvOS 13.0, macCatalyst 13.0, watchOS 6.0, *)
@discardableResult
public static func += <C: Cancellable>(lhs: Lifetime, rhs: C) -> Disposable? {
lhs.observeEnded(rhs.cancel)
}
}

@available(macOS 10.15, iOS 13.0, tvOS 13.0, macCatalyst 13.0, watchOS 6.0, *)
extension AnyDisposable: Cancellable {
public func cancel() {
dispose()
}
}

@available(macOS 10.15, iOS 13.0, tvOS 13.0, macCatalyst 13.0, watchOS 6.0, *)
extension SerialDisposable: Cancellable {
public func cancel() {
dispose()
}
}

@available(macOS 10.15, iOS 13.0, tvOS 13.0, macCatalyst 13.0, watchOS 6.0, *)
extension CompositeDisposable: Cancellable {
public func cancel() {
dispose()
public static func += <C: Cancellable>(lhs: Lifetime, rhs: C?) -> Disposable? {
rhs.flatMap { lhs.observeEnded($0.cancel) }
}
}
#endif