Classes
The following classes are available globally.
-
An object that represents the eventual completion or failure of an asynchronous operation, and its resulting value.
See moreDeclaration
Swift
public class PromiseLite<Value>
-
A default implementation of
PromiseLiteDebugger
.To enable logging promises just set
PromiseLiteConfig.debugger
variable, likePromiseLiteConfig.debugger = DefaultPromiseLiteDebugger { print($0) }
.Example
Given the following chaining:
Promise.resolve(3) .map { _ in throw FooError.π₯ } .map { _ in "foo" } .catch { _ in return "goo" } .map { $0 }
Logs using
print
the follwing outputs:
See moreπ | PromiseLite<Int> resolves β in 0.00 sec π | PromiseLite<()> rejects β in 0.00 sec with error: π₯ π | PromiseLite<String> rejects β in 0.00 sec with error: π₯ π | PromiseLite<String> resolves β in 0.00 sec π | PromiseLite<String> resolves β in 0.00 sec
Declaration
Swift
public final class DefaultPromiseLiteDebugger : PromiseLiteDebugger