diff --git a/Sources/Disposable/Disposable.swift b/Sources/Disposable/Disposable.swift index 1fd8569..9b1fc06 100644 --- a/Sources/Disposable/Disposable.swift +++ b/Sources/Disposable/Disposable.swift @@ -44,11 +44,6 @@ extension Disposable where Self == AutoDisposable { public func erased() -> ErasedDisposable { ErasedDisposable(self) } - - public func take() -> ErasedDisposable { - take() - return ErasedDisposable(self) - } } extension Disposable where Self == ErasedDisposable { diff --git a/Sources/Disposable/Task.swift b/Sources/Disposable/Task.swift index fc959e1..b8474c5 100644 --- a/Sources/Disposable/Task.swift +++ b/Sources/Disposable/Task.swift @@ -22,7 +22,7 @@ extension Disposables { mode: Mode, priority: TaskPriority? = nil, action: @escaping @Sendable () async -> Success, - onDispose: @escaping @Sendable () -> Void + onDispose: @escaping @Sendable () -> Void = { } ) where Failure == Never { let disposable = ErasedDisposable(disposal: onDispose) self.disposable = disposable @@ -43,7 +43,7 @@ extension Disposables { mode: Mode, priority: TaskPriority? = nil, action: @escaping @Sendable () async throws -> Success, - onDispose: @escaping @Sendable () -> Void + onDispose: @escaping @Sendable () -> Void = { } ) where Failure == any Error { let action = { try SwiftTask.checkCancellation() @@ -110,7 +110,7 @@ extension Disposables { public static func attached( priority: TaskPriority? = nil, action: @escaping @Sendable () async -> Success, - onDispose: @escaping @Sendable () -> Void + onDispose: @escaping @Sendable () -> Void = { } ) -> Task where Failure == Never { .init(mode: .attached, priority: priority, action: action, onDispose: onDispose) } @@ -127,7 +127,7 @@ extension Disposables { public static func attached( priority: TaskPriority? = nil, action: @escaping @Sendable () async throws -> Success, - onDispose: @escaping @Sendable () -> Void + onDispose: @escaping @Sendable () -> Void = { } ) -> Task where Failure == any Error { .init(mode: .attached, priority: priority, action: action, onDispose: onDispose) } @@ -145,7 +145,7 @@ extension Disposables { public static func detached( priority: TaskPriority? = nil, action: @escaping @Sendable () async -> Success, - onDispose: @escaping @Sendable () -> Void + onDispose: @escaping @Sendable () -> Void = { } ) -> Task where Failure == Never { .init(mode: .detached, priority: priority, action: action, onDispose: onDispose) } @@ -164,7 +164,7 @@ extension Disposables { public static func detached( priority: TaskPriority? = nil, action: @escaping @Sendable () async throws -> Success, - onDispose: @escaping @Sendable () -> Void + onDispose: @escaping @Sendable () -> Void = { } ) -> Task where Failure == any Error { .init(mode: .detached, priority: priority, action: action, onDispose: onDispose) }