ReferenceValetAdopter
public protocol ReferenceValetAdopter: class
A protocol to share ReferenceValet-powered closure shortcuts
-
enclose(in:)Extension methodPasses self as an argument instead of having to create a capture list and check boilerplate code
Declaration
Swift
public func enclose(in closure: @escaping (Self) -> Void) -> () -> VoidParameters
closureclosure containing the business logic
-
enclose(in:)Extension methodPasses self as an argument instead of having to create a capture list and check boilerplate code
Declaration
Swift
public func enclose<A>(in closure: @escaping (Self, A) -> Void) -> (A) -> VoidParameters
closureclosure containing the business logic
-
enclose(in:)Extension methodPasses self as an argument instead of having to create a capture list and check boilerplate code
Declaration
Swift
public func enclose<A, B>(in closure: @escaping (Self, A, B) -> Void) -> (A, B) -> VoidParameters
closureclosure containing the business logic
-
enclose(in:)Extension methodPasses self as an argument instead of having to create a capture list and check boilerplate code
Declaration
Swift
public func enclose<A, B, C>(in closure: @escaping (Self, A, B, C) -> Void) -> (A, B, C) -> VoidParameters
closureclosure containing the business logic
-
enclose(in:)Extension methodPasses self as an argument instead of having to create a capture list and check boilerplate code
Declaration
Swift
public func enclose<Result>(in closure: @escaping (Self) -> Result) -> () -> Result where Result: ExpressibleByNilLiteralParameters
closureclosure containing the business logic
Return Value
the givens closure’s result or nil if reference doesn’t exits
-
enclose(in:)Extension methodPasses self as an argument instead of having to create a capture list and check boilerplate code
Declaration
Swift
public func enclose<Result, A>(in closure: @escaping (Self, A) -> Result) -> (A) -> Result where Result: ExpressibleByNilLiteralParameters
closureclosure containing the business logic
Return Value
the givens closure’s result or nil if reference doesn’t exits
-
enclose(in:)Extension methodPasses self as an argument instead of having to create a capture list and check boilerplate code
Declaration
Swift
public func enclose<Result, A, B>(in closure: @escaping (Self, A, B) -> Result) -> (A, B) -> Result where Result: ExpressibleByNilLiteralParameters
closureclosure containing the business logic
Return Value
the givens closure’s result or nil if reference doesn’t exits
-
enclose(in:)Extension methodPasses self as an argument instead of having to create a capture list and check boilerplate code
Declaration
Swift
public func enclose<Result, A, B, C>(in closure: @escaping (Self, A, B, C) -> Result) -> (A, B, C) -> Result where Result: ExpressibleByNilLiteralParameters
closureclosure containing the business logic
Return Value
the givens closure’s result or nil if reference doesn’t exits
-
enclose(defaultingTo:in:)Extension methodPasses self as an argument instead of having to create a capture list and check boilerplate code
Declaration
Swift
public func enclose<Result>(defaultingTo result: Result, in closure: @escaping (Self) -> Result) -> () -> ResultParameters
closureclosure containing the business logic
Return Value
the wrapped closure
-
enclose(defaultingTo:in:)Extension methodPasses self as an argument instead of having to create a capture list and check boilerplate code
Declaration
Swift
public func enclose<Result, A>(defaultingTo result: Result, in closure: @escaping (Self, A) -> Result) -> (A) -> ResultParameters
closureclosure containing the business logic
Return Value
the wrapped closure
-
enclose(defaultingTo:in:)Extension methodPasses self as an argument instead of having to create a capture list and check boilerplate code
Declaration
Swift
public func enclose<Result, A, B>(defaultingTo result: Result, in closure: @escaping (Self, A, B) -> Result) -> (A, B) -> ResultParameters
closureclosure containing the business logic
Return Value
the wrapped closure
-
enclose(defaultingTo:in:)Extension methodPasses self as an argument instead of having to create a capture list and check boilerplate code
Declaration
Swift
public func enclose<Result, A, B, C>(defaultingTo result: Result, in closure: @escaping (Self, A, B, C) -> Result) -> (A, B, C) -> ResultParameters
closureclosure containing the business logic
Return Value
the wrapped closure
-
call(_:with:)Extension methodCalls the given closure with self passed to it (instead of having to add capture list and then check if reference exists).
Declaration
Swift
public func call(_ target: (@escaping () -> Void) throws -> Void, with closure: @escaping (Self) -> Void) rethrowsParameters
targetthe function to pass the trailing closure to
closureclosure containing the final argument to be passed to the target function
-
call(_:with:)Extension methodCalls the given closure with self passed to it (instead of having to add capture list and then check if reference exists).
Declaration
Swift
public func call<X, Y>(_ target: (@escaping () -> X) throws -> Y, with closure: @escaping (Self) -> X) rethrows -> Y where X: ExpressibleByNilLiteralParameters
targetthe function to pass the trailing closure to
closureclosure containing the final argument to be passed to the target function
Return Value
the result of the target function
-
call(_:defaultingTo:on:)Extension methodCalls the given closure with self passed to it (instead of having to add capture list and then check if reference exists).
Declaration
Swift
public func call<X, Y>(_ target: (@escaping () -> X) throws -> Y, defaultingTo result: X, on closure: @escaping (Self) -> X) rethrows -> YParameters
targetthe function to pass the trailing closure to
resultthe default result in case the reference no long exists
closureclosure containing the final argument to be passed to the target function
Return Value
the result of the target function
-
async(on:with:)Extension methodCalls async on the given dispatch queue (or the main queue if not specified) with the closure that is supplied. Saves adding the capture list and checking if reference exists.
Declaration
Swift
public func async(on queue: DispatchQueue = DispatchQueue.main, with closure: @escaping (Self) -> Void)Parameters
queuequeue to run task on
closureclosure containing the task
-
call(_:_:with:)Extension methodCalls the given closure with given argument and self passed to it (instead of having to add capture list and then check if reference exists)
Declaration
Swift
public func call<A>(_ target: (A, @escaping () -> Void) throws -> Void, _ a: A, with closure: @escaping (Self) -> Void) rethrowsParameters
targetthe function to pass the trailing closure to
afirst argument to pass to the target function
closureclosure containing the final argument to be passed to the target function
-
call(_:_:_:with:)Extension methodCalls the given closure with given arguments and self passed to it (instead of having to add capture list and then check if reference exists)
Declaration
Swift
public func call<A, B>(_ target: (A, B, @escaping () -> Void) throws -> Void, _ a: A, _ b: B, with closure: @escaping (Self) -> Void) rethrowsParameters
targetthe function to pass the trailing closure to
afirst argument to pass to the target function
bsecond argument to pass to the target function
closureclosure containing the final argument to be passed to the target function
-
call(_:_:_:_:with:)Extension methodCalls the given closure with given arguments and self passed to it (instead of having to add capture list and then check if reference exists)
Declaration
Swift
public func call<A, B, C>(_ target: (A, B, C, @escaping () -> Void) throws -> Void, _ a: A, _ b: B, _ c: C, with closure: @escaping (Self) -> Void) rethrowsParameters
targetthe function to pass the trailing closure to
afirst argument to pass to the target function
bsecond argument to pass to the target function
cthird argument to pass to the target function
closureclosure containing the final argument to be passed to the target function
-
call(_:_:with:)Extension methodCalls the given closure with given argument and self passed to it (instead of having to add capture list and then check if reference exists)
Declaration
Swift
public func call<X, Y, A>(_ target: (A, @escaping () -> X) throws -> Y, _ a: A, with closure: @escaping (Self) -> X) rethrows -> Y where X: ExpressibleByNilLiteralParameters
targetthe function to pass the trailing closure to
afirst argument to pass to the target function
closureclosure containing the final argument to be passed to the target function
Return Value
the result of the target function
-
call(_:_:_:with:)Extension methodCalls the given closure with given arguments and self passed to it (instead of having to add capture list and then check if reference exists)
Declaration
Swift
public func call<X, Y, A, B>(_ target: (A, B, @escaping () -> X) throws -> Y, _ a: A, _ b: B, with closure: @escaping (Self) -> X) rethrows -> Y where X: ExpressibleByNilLiteralParameters
targetthe function to pass the trailing closure to
afirst argument to pass to the target function
bsecond argument to pass to the target function
closureclosure containing the final argument to be passed to the target function
Return Value
the result of the target function
-
call(_:_:_:_:with:)Extension methodCalls the given closure with given arguments and self passed to it (instead of having to add capture list and then check if reference exists)
Declaration
Swift
public func call<X, Y, A, B, C>(_ target: (A, B, C, @escaping () -> X) throws -> Y, _ a: A, _ b: B, _ c: C, with closure: @escaping (Self) -> X) rethrows -> Y where X: ExpressibleByNilLiteralParameters
targetthe function to pass the trailing closure to
afirst argument to pass to the target function
bsecond argument to pass to the target function
cthird argument to pass to the target function
closureclosure containing the final argument to be passed to the target function
Return Value
the result of the target function
ReferenceValetAdopter Protocol Reference