It's best to put CLLocationManagerDelegate
related code in a viewComponent
(UIViewController
) and handle things from there, UIViewController is already inherited from NSObject
so there's no need to change core actors of PureMVC (Notifier
in this case).
Another option is to create an independent class to manage location related activities, for instance instantiate a Mediator LocationMediator
instantiating class Location: NSObject, CLLocationManagerDelegate
as it's viewComponent and setting itself as a delegate via ILocation
protocol.
LocationMediator
would listen to any events from it's viewComponent via ILocation
delegate and it would then send a notification that other interested actors can respond to.
Hardware related activity belongs to View
Any hardware related activity for instance Camera, GPS, Accelerometer, Gyroscope and non-hardware elements like Router in a browser typically generate events and belong to view tier of the MVC paradigm and should be handled inside a view component. Any triggered events within viewComponents are then handled by it's mediator if it needs to communicate to the other parts of the system. Proxy
is best suited for web services or persistence.