IController
public protocol IController
The interface definition for a PureMVC Controller.
In PureMVC, an IController implementor
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 org.puremvc.swift.multicore.interfaces ICommand
-
Initialize the
Controllerinstance.Declaration
Swift
func initializeController() -
Register a particular
ICommandclass as the handler for a particularINotification.Declaration
Swift
func registerCommand(_ notificationName: String, factory: @escaping () -> ICommand)Parameters
notificationNamethe name of the
INotificationclosurereference that returns
ICommand -
Execute the
ICommandpreviously registered as the handler forINotifications with the given notification name.Declaration
Swift
func executeCommand(_ notification: INotification)Parameters
notificationthe
INotificationto execute the associatedICommandfor -
Check if a Command is registered for a given Notification
Declaration
Swift
func hasCommand(_ notificationName: String) -> BoolParameters
notificationNameReturn Value
whether a Command is currently registered for the given
notificationName. -
Remove a previously registered
ICommandtoINotificationmapping.Declaration
Swift
func removeCommand(_ notificationName: String)Parameters
notificationNamethe name of the
INotificationto remove theICommandmapping for
IController Protocol Reference