-
Returns a
Guarantee
sealed with the provided value.Declaration
Swift
public static func value(_ value: T) -> Guarantee<T>
-
Returns a pending
Guarantee
that can be resolved with the provided closure’s parameter.Declaration
Swift
public init(resolver body: (@escaping (T) -> Void) -> Void)
-
See
Thenable.pipe
Declaration
Swift
public func pipe(to: @escaping (Result<T>) -> Void)
-
See
Thenable.result
Declaration
Swift
public var result: Result<T>? { get }
-
Returns a tuple of a pending
Guarantee
and a function that resolves it.Declaration
Swift
public class func pending() -> (guarantee: Guarantee<T>, resolve: (T) -> Void)
-
Undocumented
Declaration
Swift
func future() -> Future<T, Never>
-
Undocumented
Declaration
Swift
@discardableResult func done(on: DispatchQueue? = conf.Q.return, flags: DispatchWorkItemFlags? = nil, _ body: @escaping (T) -> Void) -> Guarantee<Void>
-
Undocumented
Declaration
Swift
func get(on: DispatchQueue? = conf.Q.return, flags: DispatchWorkItemFlags? = nil, _ body: @escaping (T) -> Void) -> Guarantee<T>
-
Undocumented
Declaration
Swift
func map<U>(on: DispatchQueue? = conf.Q.map, flags: DispatchWorkItemFlags? = nil, _ body: @escaping (T) -> U) -> Guarantee<U>
-
Undocumented
Declaration
Swift
func map<U>(on: DispatchQueue? = conf.Q.map, flags: DispatchWorkItemFlags? = nil, _ keyPath: KeyPath<T, U>) -> Guarantee<U>
-
Undocumented
Declaration
Swift
@discardableResult func then<U>(on: DispatchQueue? = conf.Q.map, flags: DispatchWorkItemFlags? = nil, _ body: @escaping (T) -> Guarantee<U>) -> Guarantee<U>
-
Undocumented
Declaration
Swift
func asVoid() -> Guarantee<Void>
-
Blocks this thread, so you know, don’t call this on a serial thread that any part of your chain may use. Like the main thread for example.
Declaration
Swift
func wait() -> T
-
Guarantee<[T]>
=>T
->U
=>Guarantee<[U]>
Guarantee.value([1,2,3]) .mapValues { integer in integer * 2 } .done { // $0 => [2,4,6] }
Declaration
Swift
func mapValues<U>(on: DispatchQueue? = conf.Q.map, flags: DispatchWorkItemFlags? = nil, _ transform: @escaping (T.Iterator.Element) -> U) -> Guarantee<[U]>
-
Guarantee<[T]>
=>KeyPath<T, U>
=>Guarantee<[U]>
Guarantee.value([Person(name: "Max"), Person(name: "Roman"), Person(name: "John")]) .mapValues(\.name) .done { // $0 => ["Max", "Roman", "John"] }
Declaration
Swift
func mapValues<U>(on: DispatchQueue? = conf.Q.map, flags: DispatchWorkItemFlags? = nil, _ keyPath: KeyPath<T.Iterator.Element, U>) -> Guarantee<[U]>
-
Guarantee<[T]>
=>T
->[U]
=>Guarantee<[U]>
Guarantee.value([1,2,3]) .flatMapValues { integer in [integer, integer] } .done { // $0 => [1,1,2,2,3,3] }
Declaration
Swift
func flatMapValues<U>(on: DispatchQueue? = conf.Q.map, flags: DispatchWorkItemFlags? = nil, _ transform: @escaping (T.Iterator.Element) -> U) -> Guarantee<[U.Iterator.Element]> where U : Sequence
-
Guarantee<[T]>
=>T
->U?
=>Guarantee<[U]>
Guarantee.value(["1","2","a","3"]) .compactMapValues { Int($0) } .done { // $0 => [1,2,3] }
Declaration
Swift
func compactMapValues<U>(on: DispatchQueue? = conf.Q.map, flags: DispatchWorkItemFlags? = nil, _ transform: @escaping (T.Iterator.Element) -> U?) -> Guarantee<[U]>
-
Guarantee<[T]>
=>KeyPath<T, U?>
=>Guarantee<[U]>
Guarantee.value([Person(name: "Max"), Person(name: "Roman", age: 26), Person(name: "John", age: 23)]) .compactMapValues(\.age) .done { // $0 => [26, 23] }
Declaration
Swift
func compactMapValues<U>(on: DispatchQueue? = conf.Q.map, flags: DispatchWorkItemFlags? = nil, _ keyPath: KeyPath<T.Iterator.Element, U?>) -> Guarantee<[U]>
-
Guarantee<[T]>
=>T
->Guarantee<U>
=>Guaranetee<[U]>
Guarantee.value([1,2,3]) .thenMap { .value($0 * 2) } .done { // $0 => [2,4,6] }
Declaration
Swift
func thenMap<U>(on: DispatchQueue? = conf.Q.map, flags: DispatchWorkItemFlags? = nil, _ transform: @escaping (T.Iterator.Element) -> Guarantee<U>) -> Guarantee<[U]>
-
Guarantee<[T]>
=>T
->Guarantee<[U]>
=>Guarantee<[U]>
Guarantee.value([1,2,3]) .thenFlatMap { integer in .value([integer, integer]) } .done { // $0 => [1,1,2,2,3,3] }
-
Guarantee<[T]>
=>T
-> Bool =>Guarantee<[T]>
Guarantee.value([1,2,3]) .filterValues { $0 > 1 } .done { // $0 => [2,3] }
Declaration
Swift
func filterValues(on: DispatchQueue? = conf.Q.map, flags: DispatchWorkItemFlags? = nil, _ isIncluded: @escaping (T.Iterator.Element) -> Bool) -> Guarantee<[T.Iterator.Element]>
-
Guarantee<[T]>
=>KeyPath<T, Bool>
=>Guarantee<[T]>
Guarantee.value([Person(name: "Max"), Person(name: "Roman", age: 26, isStudent: false), Person(name: "John", age: 23, isStudent: true)]) .filterValues(\.isStudent) .done { // $0 => [Person(name: "John", age: 23, isStudent: true)] }
Declaration
Swift
func filterValues(on: DispatchQueue? = conf.Q.map, flags: DispatchWorkItemFlags? = nil, _ keyPath: KeyPath<T.Iterator.Element, Bool>) -> Guarantee<[T.Iterator.Element]>
-
Guarantee<[T]>
=> (T
,T
) -> Bool =>Guarantee<[T]>
Guarantee.value([5,2,3,4,1]) .sortedValues { $0 > $1 } .done { // $0 => [5,4,3,2,1] }
Declaration
Swift
func sortedValues(on: DispatchQueue? = conf.Q.map, flags: DispatchWorkItemFlags? = nil, _ areInIncreasingOrder: @escaping (T.Iterator.Element, T.Iterator.Element) -> Bool) -> Guarantee<[T.Iterator.Element]>
-
Guarantee<[T]>
=>Guarantee<[T]>
Guarantee.value([5,2,3,4,1]) .sortedValues() .done { // $0 => [1,2,3,4,5] }
Declaration
Swift
func sortedValues(on: DispatchQueue? = conf.Q.map, flags: DispatchWorkItemFlags? = nil) -> Guarantee<[T.Iterator.Element]>