Protocols
The following protocols are available globally.
-
The interface definition for a PureMVC Controller.
In PureMVC, an
IControllerimplementor follows the ‘Command and Controller’ strategy, and assumes these responsibilities:- Remembering which
ICommands are intended to handle whichINotifications. - Registering itself as an
IObserverwith theViewfor eachINotificationthat it has anICommandmapping for. - Creating a new instance of the proper
ICommandto handle a givenINotificationwhen notified by theView. - Calling the
ICommand‘sexecutemethod, passing in theINotification.
@see org.puremvc.swift.multicore.interfaces INotification
See more@see org.puremvc.swift.multicore.interfaces ICommandDeclaration
Swift
public protocol IController - Remembering which
-
The interface definition for a PureMVC Facade.
The Facade Pattern suggests providing a single class to act as a central point of communication for a subsystem.
In PureMVC, the Facade acts as an interface between the core MVC actors (Model, View, Controller) and the rest of your application.
@see org.puremvc.swift.multicore.interfaces.IModel IModel@see org.puremvc.swift.multicore.interfaces.IView IView@see org.puremvc.swift.multicore.interfaces.IController IController@see org.puremvc.swift.multicore.interfaces.ICommand ICommand
See more@see org.puremvc.swift.multicore.interfaces.INotification INotificationDeclaration
Swift
public protocol IFacade : INotifier -
The interface definition for a PureMVC Mediator.
In PureMVC,
IMediatorimplementors assume these responsibilities:- Implement a common method which returns a list of all
INotifications theIMediatorhas interest in. - Implement a notification callback method.
- Implement methods that are called when the IMediator is registered or removed from the View.
Additionally,
IMediators typically:- Act as an intermediary between one or more view components such as text boxes or list controls, maintaining references and coordinating their behavior.
- In Flash-based apps, this is often the place where event listeners are added to view components, and their handlers implemented.
- Respond to and generate
INotifications, interacting with of the rest of the PureMVC app.
When an
IMediatoris registered with theIView, theIViewwill call theIMediator‘slistNotificationInterestsmethod. TheIMediatorwill return anArrayofINotificationnames which it wishes to be notified about.The
IViewwill then create anObserverobject encapsulating thatIMediator’s (handleNotification) method and register it as an Observer for eachINotificationname returned bylistNotificationInterests.
See more@see org.puremvc.swift.multicore.interfaces.INotification INotificationDeclaration
Swift
public protocol IMediator : INotifier - Implement a common method which returns a list of all
-
The interface definition for a PureMVC Model.
In PureMVC,
IModelimplementors provide access toIProxyobjects by named lookup.An
IModelassumes these responsibilities:- Maintain a cache of
IProxyinstances - Provide methods for registering, retrieving, and removing
IProxyinstances
Declaration
Swift
public protocol IModel - Maintain a cache of
-
The interface definition for a PureMVC Notification.
PureMVC does not rely upon underlying event models such as the one provided with Flash, and ActionScript 3 does not have an inherent event model.
The Observer Pattern as implemented within PureMVC exists to support event-driven communication between the application and the actors of the MVC triad.
Notifications are not meant to be a replacement for Events in Flex/Flash/AIR. Generally,
IMediatorimplementors place event listeners on their view components, which they then handle in the usual way. This may lead to the broadcast ofNotifications to triggerICommands or to communicate with otherIMediators.IProxyandICommandinstances communicate with each other andIMediators by broadcastingINotifications.A key difference between Flash
Events and PureMVCNotifications is thatEvents follow the ‘Chain of Responsibility’ pattern, ‘bubbling’ up the display hierarchy until some parent component handles theEvent, while PureMVCNotifications follow a ‘Publish/Subscribe’ pattern. PureMVC classes need not be related to each other in a parent/child relationship in order to communicate with one another usingNotifications.@see org.puremvc.swift.multicore.interfaces.IView IView
See more@see org.puremvc.swift.multicore.interfaces.IObserver IObserverDeclaration
Swift
public protocol INotification -
The interface definition for a PureMVC Notifier.
MacroCommand, Command, MediatorandProxyall have a need to sendNotifications.The
INotifierinterface provides a common method calledsendNotificationthat relieves implementation code of the necessity to actually constructNotifications.The
Notifierclass, which all of the above mentioned classes extend, also provides an initialized reference to theFacadeSingleton, which is required for the convienience method for sendingNotifications, but also eases implementation as these classes have frequentFacadeinteractions and usually require access to the facade anyway.@see org.puremvc.swift.multicore.interfaces.IFacade IFacade
See more@see org.puremvc.swift.multicore.interfaces.INotification INotificationDeclaration
Swift
public protocol INotifier -
The interface definition for a PureMVC Observer.
In PureMVC,
IObserverimplementors assume these responsibilities:- Encapsulate the notification (callback) method of the interested object.
- Encapsulate the notification context (self) of the interested object.
- Provide methods for setting the interested object’ notification method and context.
- Provide a method for notifying the interested object.
PureMVC does not rely upon underlying event models such as the one provided with Flash, and ActionScript 3 does not have an inherent event model.
The Observer Pattern as implemented within PureMVC exists to support event driven communication between the application and the actors of the MVC triad.
An Observer is an object that encapsulates information about an interested object with a notification method that should be called when an
INotificationis broadcast. The Observer then acts as a proxy for notifying the interested object.Observers can receive
Notifications by having theirnotifyObservermethod invoked, passing in an object implementing theINotificationinterface, such as a subclass ofNotification.@see org.puremvc.swift.multicore.interfaces.IView IView
See more@see org.puremvc.swift.multicore.interfaces.INotification INotificationDeclaration
Swift
public protocol IObserver -
The interface definition for a PureMVC Proxy.
In PureMVC,
IProxyimplementors assume these responsibilities:- Implement a common method which returns the name of the Proxy.
- Provide methods for setting and getting the data object.
Additionally,
IProxys typically:- Maintain references to one or more pieces of model data.
- Provide methods for manipulating that data.
- Generate
INotificationswhen their model data changes. - Expose their name as a
public static constcalledNAME, if they are not instantiated multiple times. - Encapsulate interaction with local or remote services used to fetch and persist model data.
Declaration
Swift
public protocol IProxy : INotifier -
The interface definition for a PureMVC View.
In PureMVC,
IViewimplementors assume these responsibilities:In PureMVC, the
Viewclass assumes these responsibilities:- Maintain a cache of
IMediatorinstances. - Provide methods for registering, retrieving, and removing
IMediators. - Managing the observer lists for each
INotificationin the application. - Providing a method for attaching
IObserversto anINotification‘s observer list. - Providing a method for broadcasting an
INotification. - Notifying the
IObserversof a givenINotificationwhen it broadcast.
@see org.puremvc.swift.multicore.interfaces.IMediator IMediator@see org.puremvc.swift.multicore.interfaces.IObserver IObserver
See more@see org.puremvc.swift.multicore.interfaces.INotification INotificationDeclaration
Swift
public protocol IView - Maintain a cache of
Protocols Reference