- Add
PromiseFuture#completeWith(_:)
to complete the promise with the result of the given future once that future is completed.
- Allow
Try#flatMap(_:)
andTry.map(_:)
to throw errors
- Set some
self
refs to be unowned for added memory safety
- Update code for Swift 2.0
- Simplify pattern matching for
Try<T>.Success
by removing value boxing workaround for the associated value - Use
ErrorType
instead ofString
for the associated value ofTry<T>.Failure
. This enables usingNSError
s for failures. - Remove
Try.success
andTry.failure
static factory functions as unnecessary - Handle thrown errors inside the closures of
Future#flatMap(_:)
andFuture#map(_:)
- Update code for Swift 1.2
- Backwards incompatible change: now
Try<T>.Success
contains its associated value inside aBox
helper object. This affects how you create a newSuccess
value and access its associated value:
func getTry<T>(x: T) -> Try<T> {
return .success(x)
}
switch getTry(42) {
case .Success(let box):
println("succeeded: \(box.value)")
case .Failure(let desc):
println("failed: \(desc)")
}
- Performance improvement: the change of
Try<T>.Success
described above together with Swift 1.2 decreased the execution time of the project's benchmark. One iteration in the benchmark takes now about ¼th of the time compared to project version 0.1.0 compiled with Swift 1.1.
- First release