diff --git a/Sources/CombineInteroperability/Utilities.swift b/Sources/CombineInteroperability/Utilities.swift index 2ffd46440..ecfa6717f 100644 --- a/Sources/CombineInteroperability/Utilities.swift +++ b/Sources/CombineInteroperability/Utilities.swift @@ -4,29 +4,7 @@ import Combine extension Lifetime { @available(macOS 10.15, iOS 13.0, tvOS 13.0, macCatalyst 13.0, watchOS 6.0, *) @discardableResult - public static func += (lhs: Lifetime, rhs: C) -> Disposable? { - lhs.observeEnded(rhs.cancel) + public static func += (lhs: Lifetime, rhs: C?) -> Disposable? { + rhs.flatMap { lhs.observeEnded($0.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() - } -} -#endif