CombineAsyncually
CombineAsyncually copied to clipboard
Why so overengineered? Am I missing something?
I get this is a demo but why not simply use the Future builder?
func TaskPublisher<T>(closure: () async throws -> T) -> AnyPublisher<T, Error> {
Deferred {
Future { emitter in
Task {
do {
let result = try await closure()
emitter(success(result))
} catch {
emitter(error(error))
}
}
}
}
}
am I missing something?