Skip to content
This repository has been archived by the owner on Aug 29, 2022. It is now read-only.

v4.0: Fire-Hose Drinking

Compare
Choose a tag to compare
@zwaldowski zwaldowski released this 11 Apr 00:29
· 25 commits to master since this release
5faced2

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 on Future and Deferred.
    • 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 renamed Task.never.
    • Task(upon:flags:onCancel:execute:) is renamed Task.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 to Task<Success> and Deferred<Value>.
    • Implementing a custom Future requires fewer method implementations.
    • Future() is renamed Future.never.
    • Future.async(upon:flags:execute:) can be used to capture the result of asynchronous work.
    • Future and Deferred conditionally have init(success:) and init(failure:), instead of requiring init(value: .success(...)).
  • Protected<Value> and TaskResult<Value> gain additional optimizations when Deferred is imported as a module.
  • Improvements to debugging, reflection, and playground support.