Completable

public protocol Completable : Cancellable, CompletionController

A protocol for objects that can be manually completed

  • Completes Completing with value and returns true. Returns false if promise was completed before.

    Declaration

    Swift

    @discardableResult
    func tryComplete(_ completion: Fallible<Success>, from originalExecutor: Executor?) -> Bool

    Parameters

    completion

    value to compete Completing with

    originalExecutor

    Executor you calling this method on. Specifying this argument will allow to perform syncronous executions on strictAsync: false Executors. Use default value or nil if you are not sure about an Executor you calling this method on.

    Return Value

    true if this call completed Completable

  • complete(with:) Extension method

    Completes completable when specified completing completes. self will retain specified future until it`s completion

    Declaration

    Swift

    func complete<T>(with completing: T) where T : Completing, Self.Success == T.Success
  • complete(_:from:) Extension method

    Shorthand to tryComplete(with:) that does not return value

    Declaration

    Swift

    func complete(_ completion: Fallible<Success>, from originalExecutor: Executor?)

    Parameters

    completion

    value to compete Completing with

    originalExecutor

    Executor you calling this method on. Specifying this argument will allow to perform syncronous executions on strictAsync: false Executors. Use default value or nil if you are not sure about an Executor you calling this method on.

  • complete(_:) Extension method

    Shorthand to tryComplete(with:) that does not return value

    Declaration

    Swift

    func complete(_ completion: Fallible<Success>)

    Parameters

    completion

    value to compete Completing with

  • trySucceed(_:from:) Extension method

    Tries to complete self with success

    Declaration

    Swift

    @discardableResult
    func trySucceed(_ success: Success, from originalExecutor: Executor? = nil) -> Bool

    Parameters

    success

    value to succeed Completing with

    originalExecutor

    Executor you calling this method on. Specifying this argument will allow to perform syncronous executions on strictAsync: false Executors. Use default value or nil if you are not sure about an Executor you calling this method on.

    Return Value

    true if this call completed Completable

  • succeed(_:from:) Extension method

    Shorthand to trySucceed(with:) that does not return value

    Declaration

    Swift

    func succeed(_ success: Success, from originalExecutor: Executor?)

    Parameters

    success

    value to succeed Completing with

    originalExecutor

    Executor you calling this method on. Specifying this argument will allow to perform syncronous executions on strictAsync: false Executors. Use default value or nil if you are not sure about an Executor you calling this method on.

  • succeed(_:) Extension method

    Shorthand to trySucceed(with:) that does not return value

    Declaration

    Swift

    func succeed(_ success: Success)

    Parameters

    success

    value to succeed Completing with

  • tryFail(_:from:) Extension method

    Tries to complete self with failure vlue

    Declaration

    Swift

    @discardableResult
    func tryFail(_ failure: Swift.Error, from originalExecutor: Executor? = nil) -> Bool

    Parameters

    failure

    error to fail Completing with

    originalExecutor

    Executor you calling this method on. Specifying this argument will allow to perform syncronous executions on strictAsync: false Executors. Use default value or nil if you are not sure about an Executor you calling this method on.

    Return Value

    true if this call completed Completable

  • fail(_:from:) Extension method

    Shorthand to tryFail(with:) that does not return value

    Declaration

    Swift

    func fail(_ failure: Swift.Error, from originalExecutor: Executor?)

    Parameters

    failure

    error to fail Completing with

    originalExecutor

    Executor you calling this method on. Specifying this argument will allow to perform syncronous executions on strictAsync: false Executors. Use default value or nil if you are not sure about an Executor you calling this method on.

  • fail(_:) Extension method

    Shorthand to tryFail(with:) that does not return value

    Declaration

    Swift

    func fail(_ failure: Swift.Error)

    Parameters

    failure

    error to fail Completing with

  • cancel() Extension method

    Completes with cancellation (AsyncNinjaError.cancelled)

    Declaration

    Swift

    func cancel()
  • cancel(from:) Extension method

    Completes with cancellation (AsyncNinjaError.cancelled)

    Declaration

    Swift

    func cancel(from originalExecutor: Executor?)

    Parameters

    originalExecutor

    Executor you calling this method on. Specifying this argument will allow to perform syncronous executions on strictAsync: false Executors. Use default value or nil if you are not sure about an Executor you calling this method on.

  • Completes with error of deallocated context (AsyncNinjaError.contextDeallocated)

    Declaration

    Swift

    func cancelBecauseOfDeallocatedContext(from originalExecutor: Executor?)

    Parameters

    originalExecutor

    Executor you calling this method on. Specifying this argument will allow to perform syncronous executions on strictAsync: false Executors. Use default value or nil if you are not sure about an Executor you calling this method on.

  • Completes with error of deallocated context (AsyncNinjaError.contextDeallocated)

    Declaration

    Swift

    func cancelBecauseOfDeallocatedContext()

    Parameters

    originalExecutor

    Executor you calling this method on. Specifying this argument will allow to perform syncronous executions on strictAsync: false Executors. Use default value or nil if you are not sure about an Executor you calling this method on.

  • succeed(from:) Extension method

    Convenience method succeeds mutable with void value

    Declaration

    Swift

    public func succeed(from originalExecutor: Executor? = nil)

    Parameters

    originalExecutor

    Executor you calling this method on. Specifying this argument will allow to perform syncronous executions on strictAsync: false Executors. Use default value or nil if you are not sure about an Executor you calling this method on.

  • complete(with:) Extension method

    Completes promise when specified future completes. self will retain specified future until it`s completion

    Declaration

    Swift

    func complete<T>(with completing: T) where T : Completing, T.Success == Self.Success.AsyncNinjaWrapped