This repository has been archived by the owner on Aug 29, 2022. It is now read-only.
v4.0: Fire-Hose Drinking
Deferred 4.0 is easier-to-use and faster than ever before.
This release is compatible with Swift 4.1, 4.2, and 5.0 on Apple platforms and Linux. This will be the last release to support Swift 4.1.
As always, the latest documentation is available here.
- Deferred optimizes for and requires Swift 4.1 or better, including Swift 5.0.
Deferred<Value>
uses up to 70% lower memory and is up to 80% faster. (#229)Task<Success>
and its related types have been redesigned to address common pain points.Task.Result
aligns with the suite of methods and naming from SE-0235, the Swift 5 Result type.- The functionality of
Task<Success>
(map(upon:transform:)
,andThen(upon:start:)
, and so on) are conditionally available onFuture
andDeferred
. - Automatic progress calculation for
Task<Success>
on macOS, iOS, tvOS, and watchOS have been revamped. This is ideal for, and now works better with,URLSessionTask
. - The bare
Task()
is renamedTask.never
. Task(upon:flags:onCancel:execute:)
is renamedTask.async(upon:flags:onCancel:execute:)
.Task.repeat(upon:count:continuingIf:to:)
can be used to simply re-attempt work if it fails.Collection.allSucceeded()
returns a combined array of all successes as its success value.
Future<Value>
benefits from changes toTask<Success>
andDeferred<Value>
.- Implementing a custom
Future
requires fewer method implementations. Future()
is renamedFuture.never
.Future.async(upon:flags:execute:)
can be used to capture the result of asynchronous work.Future
andDeferred
conditionally haveinit(success:)
andinit(failure:)
, instead of requiringinit(value: .success(...))
.
- Implementing a custom
Protected<Value>
andTaskResult<Value>
gain additional optimizations when Deferred is imported as a module.- Improvements to debugging, reflection, and playground support.