IModel

public protocol IModel

The interface definition for a PureMVC Model.

In PureMVC, IModel implementors provide access to IProxy objects by named lookup.

An IModel assumes these responsibilities:

  • Maintain a cache of IProxy instances
  • Provide methods for registering, retrieving, and removing IProxy instances
  • Initialize the Model instance.

    Declaration

    Swift

    func initializeModel()
  • Register an IProxy instance with the Model.

    Declaration

    Swift

    func registerProxy(_ proxy: IProxy)

    Parameters

    proxyName

    the name to associate with this IProxy instance.

    proxy

    an object reference to be held by the Model.

  • Retrieve an IProxy instance from the Model.

    Declaration

    Swift

    func retrieveProxy(_ proxyName: String) -> IProxy?

    Parameters

    proxyName

    Return Value

    the IProxy instance previously registered with the given proxyName.

  • Check if a Proxy is registered

    Declaration

    Swift

    func hasProxy(_ proxyName: String) -> Bool

    Parameters

    proxyName

    Return Value

    whether a Proxy is currently registered with the given proxyName.

  • Remove an IProxy instance from the Model.

    Declaration

    Swift

    @discardableResult
    func removeProxy(_ proxyName: String) -> IProxy?

    Parameters

    proxyName

    name of the IProxy instance to be removed.

    Return Value

    the IProxy that was removed from the Model