ReferenceValetAdopter

public protocol ReferenceValetAdopter: class

A protocol to share ReferenceValet-powered closure shortcuts

  • enclose(in:) Extension method

    Passes 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) -> () -> Void

    Parameters

    closure

    closure containing the business logic

  • enclose(in:) Extension method

    Passes 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) -> Void

    Parameters

    closure

    closure containing the business logic

  • enclose(in:) Extension method

    Passes 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) -> Void

    Parameters

    closure

    closure containing the business logic

  • enclose(in:) Extension method

    Passes 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) -> Void

    Parameters

    closure

    closure containing the business logic

  • enclose(in:) Extension method

    Passes 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: ExpressibleByNilLiteral

    Parameters

    closure

    closure containing the business logic

    Return Value

    the givens closure’s result or nil if reference doesn’t exits

  • enclose(in:) Extension method

    Passes 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: ExpressibleByNilLiteral

    Parameters

    closure

    closure containing the business logic

    Return Value

    the givens closure’s result or nil if reference doesn’t exits

  • enclose(in:) Extension method

    Passes 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: ExpressibleByNilLiteral

    Parameters

    closure

    closure containing the business logic

    Return Value

    the givens closure’s result or nil if reference doesn’t exits

  • enclose(in:) Extension method

    Passes 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: ExpressibleByNilLiteral

    Parameters

    closure

    closure containing the business logic

    Return Value

    the givens closure’s result or nil if reference doesn’t exits

  • enclose(defaultingTo:in:) Extension method

    Passes 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) -> () -> Result

    Parameters

    closure

    closure containing the business logic

    Return Value

    the wrapped closure

  • enclose(defaultingTo:in:) Extension method

    Passes 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) -> Result

    Parameters

    closure

    closure containing the business logic

    Return Value

    the wrapped closure

  • enclose(defaultingTo:in:) Extension method

    Passes 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) -> Result

    Parameters

    closure

    closure containing the business logic

    Return Value

    the wrapped closure

  • enclose(defaultingTo:in:) Extension method

    Passes 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) -> Result

    Parameters

    closure

    closure containing the business logic

    Return Value

    the wrapped closure

  • call(_:with:) Extension method

    Calls 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) rethrows

    Parameters

    target

    the function to pass the trailing closure to

    closure

    closure containing the final argument to be passed to the target function

  • call(_:with:) Extension method

    Calls 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: ExpressibleByNilLiteral

    Parameters

    target

    the function to pass the trailing closure to

    closure

    closure containing the final argument to be passed to the target function

    Return Value

    the result of the target function

  • call(_:defaultingTo:on:) Extension method

    Calls 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 -> Y

    Parameters

    target

    the function to pass the trailing closure to

    result

    the default result in case the reference no long exists

    closure

    closure containing the final argument to be passed to the target function

    Return Value

    the result of the target function

  • async(on:with:) Extension method

    Calls 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

    queue

    queue to run task on

    closure

    closure containing the task

  • call(_:_:with:) Extension method

    Calls 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) rethrows

    Parameters

    target

    the function to pass the trailing closure to

    a

    first argument to pass to the target function

    closure

    closure containing the final argument to be passed to the target function

  • call(_:_:_:with:) Extension method

    Calls 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) rethrows

    Parameters

    target

    the function to pass the trailing closure to

    a

    first argument to pass to the target function

    b

    second argument to pass to the target function

    closure

    closure containing the final argument to be passed to the target function

  • call(_:_:_:_:with:) Extension method

    Calls 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) rethrows

    Parameters

    target

    the function to pass the trailing closure to

    a

    first argument to pass to the target function

    b

    second argument to pass to the target function

    c

    third argument to pass to the target function

    closure

    closure containing the final argument to be passed to the target function

  • call(_:_:with:) Extension method

    Calls 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: ExpressibleByNilLiteral

    Parameters

    target

    the function to pass the trailing closure to

    a

    first argument to pass to the target function

    closure

    closure containing the final argument to be passed to the target function

    Return Value

    the result of the target function

  • call(_:_:_:with:) Extension method

    Calls 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: ExpressibleByNilLiteral

    Parameters

    target

    the function to pass the trailing closure to

    a

    first argument to pass to the target function

    b

    second argument to pass to the target function

    closure

    closure containing the final argument to be passed to the target function

    Return Value

    the result of the target function

  • call(_:_:_:_:with:) Extension method

    Calls 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: ExpressibleByNilLiteral

    Parameters

    target

    the function to pass the trailing closure to

    a

    first argument to pass to the target function

    b

    second argument to pass to the target function

    c

    third argument to pass to the target function

    closure

    closure containing the final argument to be passed to the target function

    Return Value

    the result of the target function