Promise

final public class Promise<Success> : Future<Success>, Completable, CachableCompletable

Promise is a future that may be manually completed by owner

  • Declaration

    Swift

    public typealias CompletingType = Future<Success>
  • Returns either completion for complete Promise or nil otherwise

    Declaration

    Swift

    override public var completion: Fallible<Success>? { get }
  • Designated initializer of promise

    Declaration

    Swift

    override public init()
  • internal use only**

    Declaration

    Swift

    override public func makeCompletionHandler(
      executor: Executor,
      _ block: @escaping (_ completion: Fallible<Success>, _ originalExecutor: Executor) -> Void
      ) -> AnyObject?
  • Completes promise with value and returns true. Returns false if promise was completed before.

    Declaration

    Swift

    public func tryComplete(
      _ completion: Fallible<Success>,
      from originalExecutor: Executor? = nil
      ) -> Bool

    Parameters

    completion

    value to complete future 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 Promise was completed with specified value

  • internal use only**

    Declaration

    Swift

    override public func _asyncNinja_retainUntilFinalization(_ releasable: Releasable)
  • internal use only**

    Declaration

    Swift

    override public func _asyncNinja_notifyFinalization(_ block: @escaping () -> Void)