This repository was archived by the owner on Feb 5, 2023. It is now read-only.
Releases: kean/Future
Releases · kean/Future
FutureX 0.13
This release is all about performance and quality of life improvements.
Ergonomic Improvements
- Supercharged
flatMap
. Add variants which allow combinations ofFuture<T, E>.flatMap { Future<T, Never> }
andFuture<T, Never>.flatMap { Future<T, E> }
- Instead of a convoluted
on(scheduler:success:failure:completion:)
method to change a scheduler you now call a separateobserve(on scheduler:)
orobserve(on queue:)
(new!) method before attaching callbacks. Theobserve(on:)
methods are almost instanteneous thanks to the fact thatFuture
is astruct
now. - Creating promises is now simpler:
Promise<Int, Error>()
instead ofFuture<Int, Error>.promise
Future(value: 1)
now compiles and automatically infers type to beFuture<Int, Never>
- Rename
attemptMap
totryMap
, implementtryMap
in terms offlatMap
- Remove
ignoreError
,materialize
is a better alternative - Attaching two callbacks via the same
on
would result in these callbacks called on the same run of run loop on the selected queue/scheduler - Add convenience
Future.init(result:)
,Promise.resolve(result:)
- Implement
CancellationTokenSource
usingFuture
, simpler implementation
Performance Improvements
Future
is a struct now.Future(value:)
andFuture(error:)
are now 2.5x times faster- Optimize the way internal Promise handlers are managed - it's just one array instead of two now, attaching callbacks 30% faster, resolve 30% faster
- Slightly increase the performance of all composition functions (by using
observe
directly) - Resolving promises concurrently from multiple threads is now up to 5x times faster
FutureX 0.12
- Remove
Scheduler
enum, it's a simple function now. See Threading for more info. - Add Swift Package Manager support
- Update README.md
FutureX 0.11
FutureCocoa
- Make FutureCocoa available on macOS, watchOS and tvOS
- Add FutureCocoa README.md
- Add
NSObject.fx.deallocated
FutureX 0.10.1
- Fix module name in FutureX.podspec
FutureX 0.10
FutureX is a completely new beast. It has a new name and it a new goal - to provide the best future implementation in Swift.
Future
There are a lot of improvements in the core part of the frameworks:
- Add custom
Scheduler
instead ofDispatchQueue
. By default the callbacks are now run with.main(immediate: true)
strategy. It runs immediately if on the main thread, otherwise asynchronously on the main thread. The rationale is provided in README. - Method
on
now returns self so that you can continue the chain. The returned result is marked as discardable. Promise
is now nested inFuture<Value, Error>
like other types likeResult
. To create a promise callFuture<Value, Error>.promise
.- Move
zip
,reduce
toextension Future where Value == Any, Error == Any
so thatFuture
would be a simple namespace (inspired by RxSwift) - Remove
isPending
- Make
Future<Value, Error>.Result
Equatable
- Rewrite README
Future Additions
There are also lots of bonus additions:
first
after
: Returns a future which succeeds after a given time interval.retry
castError
ignoreError
materialize
that uses built-inNever
to indicate that the error is not possiblecastError
mapThrowing
CancellationToken
FutureX now ships with a CancellationToken
implementation. See rational in README.
FutureCocoa
An initial version of Future extensions for native frameworks.
Pill 0.9
Pill 0.8.1
- Documentation improvements
Pill 0.8
map
andmapError
now no longer require intermediateFuture
instance to be created, increased performance by up to 40%.map
,flatMap
,mapError
,flatMapError
now run on the queue on which the future was resolved. It increases the performance of a typical chain by up to 3 times and also simplifies debugging - there are lessqueue.async
operations being performed.- Remove
observeOn
. It was introducing unwanted state inFuture
. To observe success/failure on a different queue use a newqueue
parameter (DispatchQueue.main
by default) ofon
method.
Pill 0.7
Pill 0.6
Pill 0.6 is a complete reimagining of the library. See a post for an overview of the changes.
- Add typed errors -
Future<Value, Error>
,Promise<Value, Error>
- Adopt functional Swift naming:
map
,flatMap
instead ofthen
- Add new methods:
zip
,reduce
- Add
observeOn
method to observe changes on differnet dispatch queues - Fix an issue where then/catch callbacks could be executed in a different from registration order
- Remove
throws
support (not type-safe)