We have an ios app that shoud detect multiple beacons , no matter in what controller it is; that is, we are showing one page of the app, and if the user goes nearby any beacon, we want to detect it and do the appropiate action.
The only way we can think to do so is duplicate the code in each controller, or make an utility procedure and call it in every controller.
Is there another form? For example, putting the code to detect in the appDelegate?
Thank you very much.
Yep, I’d either put the beacon logic in the AppDelegate, or create a singleton class that would encapsulate the beacon manager and its delegate, and because it’s a singleton, it’s available in all the controllers.
If you’re not yet familiar with the singleton pattern, you can read about it here:
There’s a few other ways you could do it, but these two mentioned are probably the easiest.
Thank you very much .