Skip to content

Commit

Permalink
Put previous signatures back as deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
davidask committed Mar 10, 2020
1 parent 8c6fc68 commit 050e6e0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
24 changes: 24 additions & 0 deletions Sources/Futures/Future.swift
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,14 @@ public extension Future {
return promise.future
}

/// :nodoc:
@available(*, deprecated, renamed: "flatMap")
func then<NewValue>(
on queue: DispatchQueue = .futures,
callback: @escaping (_ value: Value) -> Future<NewValue>) -> Future<NewValue> {
flatMap(on: queue, callback: callback)
}

/// When the current `Future` is rejected, run the provided callback reurning a new `Future<Value>`.
///
/// This allows you to proceed with some other operation if the current `Future` was rejected, due to an error
Expand Down Expand Up @@ -328,6 +336,14 @@ public extension Future {
return promise.future
}

/// :nodoc:
@available(*, deprecated, renamed: "flatMapIfRejected")
func thenIfRejected(
on queue: DispatchQueue = .futures,
callback: @escaping(Error) -> Future<Value>) -> Future<Value> {
flatMapIfRejected(on: queue, callback: callback)
}

/// When the current `Future` is fulfilled, run the provided callback returning a fulfilled value of the
/// `Future<NewValue>` returned by this method.
///
Expand All @@ -350,6 +366,14 @@ public extension Future {
}
}

/// :nodoc:
@available(*, deprecated, renamed: "flatMapThrowing")
func thenThrowing<NewValue>(
on queue: DispatchQueue = .futures,
callback: @escaping (Value) throws -> NewValue) -> Future<NewValue> {
flatMapThrowing(on: queue, callback: callback)
}

/// When the current `Future` is fulfilled, run the provided callback returning a fulfilled value of the
/// `Future<NewValue>` returned by this method.
///
Expand Down
Binary file modified docs/docsets/.tgz
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/undocumented.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
{
"file": "/Users/davidask/Github/formbound/Futures/Sources/Futures/Future.swift",
"line": 404,
"line": 428,
"symbol": "Future.mapIfRejected(on:callback:)",
"symbol_kind": "source.lang.swift.decl.function.method.instance",
"warning": "undocumented"
Expand Down

0 comments on commit 050e6e0

Please sign in to comment.