IView
public protocol IView
The interface definition for a PureMVC View.
In PureMVC, IView implementors assume these responsibilities:
In PureMVC, the View class 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 org.puremvc.swift.multicore.interfaces.INotification INotification
-
Initialize the
Viewinstance.Declaration
Swift
func initializeView() -
Notify the
IObserversfor a particularINotification.All previously attached
IObserversfor thisINotification‘s list are notified and are passed a reference to theINotificationin the order in which they were registered.Declaration
Swift
func notifyObservers(_ notification: INotification)Parameters
notificationthe
INotificationto notifyIObserversof. -
Remove a group of observers from the observer list for a given Notification name.
Declaration
Swift
func removeObserver(_ notificationName: String, notifyContext: AnyObject)Parameters
notificationNamewhich observer list to remove from
notifyContextremoved the observers with this object as their notifyContext
-
Register an
IMediatorinstance with theView.Registers the
IMediatorso that it can be retrieved by name, and further interrogates theIMediatorfor itsINotificationinterests.If the
IMediatorreturns anyINotificationnames to be notified about, anObserveris created encapsulating theIMediatorinstance’shandleNotificationmethod and registering it as anObserverfor allINotificationstheIMediatoris interested in.Declaration
Swift
func registerMediator(_ mediator: IMediator) -
Check if a Mediator is registered or not
Declaration
Swift
func hasMediator(_ mediatorName: String) -> BoolParameters
mediatorNameReturn Value
whether a Mediator is registered with the given
mediatorName.
IView Protocol Reference