Classes
The following classes are available globally.
-
A Multiton
IControllerimplementation.In PureMVC, the
Controllerclass 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.
Your application must register
ICommandswith the Controller.The simplest way is to subclass
Facade, and use itsinitializeControllermethod to add your registrations.@see org.puremvc.swift.multicore.core.View View@see org.puremvc.swift.multicore.patterns.observer.Observer Observer@see org.puremvc.swift.multicore.patterns.observer.Notification Notification@see org.puremvc.swift.multicore.patterns.command.SimpleCommand SimpleCommand
See more@see org.puremvc.swift.multicore.patterns.command.MacroCommand MacroCommandDeclaration
Swift
open class Controller : IController - Remembering which
-
A Multiton
IModelimplementation.In PureMVC, the
Modelclass provides access to model objects (Proxies) by named lookup.The
Modelassumes these responsibilities:- Maintain a cache of
IProxyinstances. - Provide methods for registering, retrieving, and removing
IProxyinstances.
Your application must register
IProxyinstances with theModel. Typically, you use anICommandto create and registerIProxyinstances once theFacadehas initialized the Core actors.@see org.puremvc.swift.multicore.patterns.proxy.Proxy Proxy
See more@see org.puremvc.swift.multicore.interfaces.IProxy IProxyDeclaration
Swift
open class Model : IModel - Maintain a cache of
-
A Multiton
IViewimplementation.In PureMVC, the
Viewclass assumes these responsibilities:- Maintain a cache of
IMediatorinstances. - Provide methods for registering, retrieving, and removing
IMediators. - Notifiying
IMediatorswhen they are registered or removed. - 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.patterns.mediator.Mediator Mediator@see org.puremvc.swift.multicore.patterns.observer.Observer Observer
See more@see org.puremvc.swift.multicore.patterns.observer.Notification NotificationDeclaration
Swift
open class View : IView - Maintain a cache of
-
A base
ICommandimplementation that executes otherICommands.A
MacroCommandmaintains an list ofICommandClass references called SubCommands.When
executeis called, theMacroCommandretrievesICommandsby executing closures and then callsexecuteon each of its SubCommands turn. Each SubCommand will be passed a reference to the originalINotificationthat was passed to theMacroCommand‘sexecutemethod.Unlike
SimpleCommand, your subclass should not overrideexecute, but instead, should override theinitializeMacroCommandmethod, callingaddSubCommandonce for each SubCommand to be executed.@see org.puremvc.swift.multicore.core.Controller Controller@see org.puremvc.swift.multicore.patterns.observer.Notification Notification
See more@see org.puremvc.swift.multicore.patterns.command.SimpleCommand SimpleCommand -
A base
ICommandimplementation.Your subclass should override the
executemethod where your business logic will handle theINotification.@see org.puremvc.swift.multicore.core.Controller Controller@see org.puremvc.swift.multicore.patterns.observer.Notification Notification
See more@see org.puremvc.swift.multicore.patterns.command.MacroCommand MacroCommand -
A base
INotificationimplementation.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/Apollo. 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 more@see org.puremvc.swift.multicore.patterns.observer.Observer Observer*Declaration
Swift
open class Notification : INotification -
A Base
INotifierimplementation.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, provides an initialized reference to theFacadeMultiton, 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.NOTE: In the MultiCore version of the framework, there is one caveat to notifiers, they cannot send notifications or reach the facade until they have a valid multitonKey.
The multitonKey is set:
- on a Command when it is executed by the Controller
- on a Mediator is registered with the View
- on a Proxy is registered with the Model.
@see org.puremvc.swift.multicore.patterns.proxy.Proxy Proxy@see org.puremvc.swift.multicore.patterns.facade.Facade Facade@see org.puremvc.swift.multicore.patterns.mediator.Mediator Mediator@see org.puremvc.swift.multicore.patterns.command.MacroCommand MacroCommand
See more@see org.puremvc.swift.multicore.patterns.command.SimpleCommand SimpleCommandDeclaration
Swift
open class Notifier : INotifier -
A base
IObserverimplementation.An
Observeris an object that encapsulates information about an interested object with a method that should be called when a particularINotificationis broadcast.In PureMVC, the
Observerclass assumes these responsibilities:- Encapsulate the notification (callback) method of the interested object.
- Encapsulate the notification context (this) of the interested object.
- Provide methods for setting the notification method and context.
- Provide a method for notifying the interested object.
@see org.puremvc.swift.multicore.core.View View
See more@see org.puremvc.swift.multicore.patterns.observer.Notification NotificationDeclaration
Swift
open class Observer : IObserver -
A base
IProxyimplementation.In PureMVC,
Proxyclasses are used to manage parts of the application’s data model.A
Proxymight simply manage a reference to a local data object, in which case interacting with it might involve setting and getting of its data in synchronous fashion.Proxyclasses are also used to encapsulate the application’s interaction with remote services to save or retrieve data, in which case, we adopt an asyncronous idiom; setting data (or calling a method) on theProxyand listening for aNotificationto be sent when theProxyhas retrieved the data from the service.
See more@see org.puremvc.swift.multicore.core.Model Model
Classes Reference