IMediator
public protocol IMediator : INotifier
The interface definition for a PureMVC Mediator.
In PureMVC, IMediator implementors 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 IMediator is registered with the IView,
the IView will call the IMediator‘s
listNotificationInterests method. The IMediator will
return an Array of INotification names which
it wishes to be notified about.
The IView will then create an Observer object
encapsulating that IMediator’s (handleNotification) method
and register it as an Observer for each INotification name returned by
listNotificationInterests.
@see org.puremvc.swift.multicore.interfaces.INotification INotification
-
Get the
IMediatorinstance nameDeclaration
Swift
var name: String { get } -
Get or set the
IMediator‘s view component.Declaration
Swift
var viewComponent: AnyObject? { get set } -
List
INotificationinterests.Declaration
Swift
func listNotificationInterests() -> [String]Return Value
an
Arrayof theINotificationnames thisIMediatorhas an interest in. -
Handle an
INotification.Declaration
Swift
func handleNotification(_ notification: INotification)Parameters
notificationthe
INotificationto be handled -
Called by the View when the Mediator is registered
Declaration
Swift
func onRegister() -
Called by the View when the Mediator is removed
Declaration
Swift
func onRemove()
IMediator Protocol Reference