AsyncProxy

A base IAsyncProxy implementation.

It allows the creator to associate data (a token) and methods that should be called when a request is completed.

Your subclass should override the asyncAction method where your domain logic will handle the async operation. Must call super to set responder and the token.

Instantiate as a proxy, with or without a name. The async activity is started by invoking the asyncAction method. There cannot be more than one activity running per instance.

@see org.puremvc.swift.standard.utilities.asyncproxy.patterns.proxy.AsyncProxy AsyncProxy

  • Message constant if an async activity is already in progress for this instance

    Declaration

    Swift

    public class var PROGRESS_MSG: String { return "Async activity already in progress for this instance!" }
  • Constructor

    Declaration

    Swift

    public init(name: String?=nil)
  • Initiate an async activity and bind result/fault handlers to it

    Declaration

    Swift

    public func asyncAction(responder: IResponder, token: Any?)

    Parameters

    responder

    IResponder type providing result and fault functions

    token

    Additional information to associate with this request.

  • This method is called by a service when the return value has been received. Optionally override this method in your subclass to manage or prepare the result followed by call to super for the responder’s result call

    Declaration

    Swift

    public func onResult(data: Any?)

    Parameters

    data

    Contains the information returned from the request.

  • This method is called by a service when an error has been received. Optionally override this method in your subclass to manage or prepare the error followed by call to super for the responder’s fault call

    Declaration

    Swift

    public func onFault(info: Any?)

    Parameters

    info

    Contains the information about the error that occured.