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
IMediator
instances. - Provide methods for registering, retrieving, and removing
IMediators
. - Managing the observer lists for each
INotification
in the application. - Providing a method for attaching
IObservers
to anINotification
‘s observer list. - Providing a method for broadcasting an
INotification
. - Notifying the
IObservers
of a givenINotification
when it broadcast.
@see org.puremvc.swift.interfaces.IMediator IMediator
@see org.puremvc.swift.interfaces.IObserver IObserver
@see org.puremvc.swift.interfaces.INotification INotification
-
Initialize the
View
instance.Declaration
Swift
func initializeView()
-
Notify the
IObservers
for a particularINotification
.All previously attached
IObservers
for thisINotification
‘s list are notified and are passed a reference to theINotification
in the order in which they were registered.Declaration
Swift
func notifyObservers(_ notification: INotification)
Parameters
notification
the
INotification
to notifyIObservers
of. -
Remove a group of observers from the observer list for a given Notification name.
Declaration
Swift
func removeObserver(_ notificationName: String, notifyContext: AnyObject)
Parameters
notificationName
which observer list to remove from
notifyContext
removed the observers with this object as their notifyContext
-
Register an
IMediator
instance with theView
.Registers the
IMediator
so that it can be retrieved by name, and further interrogates theIMediator
for itsINotification
interests.If the
IMediator
returns anyINotification
names to be notified about, anObserver
is created encapsulating theIMediator
instance’shandleNotification
method and registering it as anObserver
for allINotifications
theIMediator
is interested in.Declaration
Swift
func registerMediator(_ mediator: IMediator)
-
Check if a Mediator is registered or not
Declaration
Swift
func hasMediator(_ mediatorName: String) -> Bool
Parameters
mediatorName
Return Value
whether a Mediator is registered with the given
mediatorName
.