April 27, 2020
- Add Linux support - #12, by Joseph Heck
- Increaes mininum supported platform requirements to iOS 11.0 / watchOS 4.0 / macOS 10.13 / tvOS 11.0
- Increase minimum supported Xcode version to Xcode 11
November 20, 2019
- Remove
FutureCompatible.swift
from the framework
November 19, 2019
- Fix Xcode warnings – 9
- Add Installation Guide and API Reference
- Remove CocoaPods support
- Drop the
X
September 1, 2019
- Add a version number compatible with Swift Package Manager
August 5, 2019
- Replace custom
Future.Result
type withSwift.Result
August 4, 2019
- Add Swift 5.0 support
- Add SwiftPM 5.0 support
- Remove Swift 4.0 and Swift 4.1 support
- Remove iOS 9, tvOS 9, watchOS 2.0, macOS 10.10 and macOS 10.11 support
April 7, 2019
Refined on
method to attach callbacks. There are just two minor changes:
- Completion closure signature is now
() -> Void
instead of(Result) -> Void
. Completion is designed to be used in addition tosuccess
andfailure
to do things like hiding activity indicators. That's why theResult
variant never really made sense. If you'd like to useResult
instead, usefuture.materialize().on { result in }
. - Add a
func on(success: (Value) -> Void)
method. Nowfuture.on { }
(with a trailing closure) is inferred by the compiler to addsuccess
closure. Previously, it used to attachcompletion
closure. This change makes it a little bit nices to attach callbacks to futures that can't produce errors (Future<_, Never>
).
There is also a change in the project structure. We now use a single multi-platform target instead of four separate targets - one for each platform.
December 15, 2018
- Add
Future
initializer which takes a throwing closure:init(catching body: () throws -> Value)
. This feature was added in the first FutureX PR #1, thanks to @moto0000! - Add
castError
variant which takes an error type as an argument - Add
Scheduler.default
which can be used to change the default scheduler which isScheduler.main
November 24, 2018
on
no longer returnsFuture
to enable future extensions, discourage putting side effects in the middle of the chain, and simplify scheduleing modelCancellationToken.noOp
renamed toCancellationToken.none
.- Add
FutureCompatible
andFutureExtension
November 22, 2018
- Method
observe(on:)
is more flexible, it can now be used to runs transformations likemap
,tryMap
on a specified queue (and actually any other transformation too, it composes really well with them). - Instead of a convenience
Future { succeed, fail in }
we now haveFuture { promise in }
which is consistent with the regular way you create Promise/Future pair and also more flexible and performant. - Inline the first handler in
Promise
. It's very often when there is only one observer for eachPromise
. These operations are now up to 15% faster. - Implement
CustomDebugStringConvertible
forPromise
November 21, 2018
This release is all about performance and quality of life 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
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
November 18, 2018
- Remove
Scheduler
enum, it's a simple function now. See Threading for more info. - Add Swift Package Manager support
- Update README.md
November 17, 2018
- Make FutureCocoa available on macOS, watchOS and tvOS
- Add FutureCocoa README.md
- Add NSObject.fx.deallocated
November 17, 2018
- Fix module name in FutureX.podspec
November 17, 2018
FutureX is a completely new beast. It has a new name and it a new goal - to provide the best future implementation in Swift.
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
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
FutureX now ships with a CancellationToken
implementation. See rational in README.
An initial version of Future extensions for native frameworks.
November 17, 2018
- Add
wait
method that blocks the current thread and waits until the future receives a result - Make
Future.Result
type public - Pass result in the completion
November 17, 2018
- Documentation improvements
November 14, 2018
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 performed.map
andmapError
now no longer require intermediateFuture
instance to be created, increased performance by up to 40%.- 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.
November 12, 2018
- Add
zip
with three arguments
November 12, 2018
Pill 0.6 is a complete reimagining of the library. See a post for a complete 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)
November 12, 2018
Updated to Swift 4.2
December 23, 2017
Improve performance:
Promise
creation is 2x faster.then(_:)
,catch(_:)
methods are now 1.4x faster.
October 17, 2017
- Swift 4
Handlers
andState
are nested types now (private)
October 21, 2016
Initial public version.
October 21, 2016
Initial version.