i have a application which is handling lots of functions and also having lots of navigations.
I am using lots of BOOLs inside my application. I know its not efficient. So I want to remve these BOOLs to create more efficient and clean application.
This is my question. For a Example lets say I have 3 UIViewControllers.
Test1 , Test2, Test3
I need to navigate to Test3 from both Test1 and Test2 view Controllers . Also if I navigate to Test3 View Controller from Test1, I need to execute one method and, if I navigate to Test3 from Test2, I need to Execute another method.
Currently what i am doing is, I am Using Globals.h and Globals.m classes to over come this problem. I create a BOOL in Globals and enable that BOOL value in Test1 and, I checked that BOOL value inside Test3 and execute the method i want.
This is just an example. I got lots of view controllers and lots of behaviors for the application. So I create lots of BOOLs inside Globals and used them in different Classes. So this is a pain to handle lots of bools in one application and it not good too. So can any one please help me how to overcome this problem.
Thanks in advance 🙂
you can also check class with NSObject method isKindOfClass.
You can also find example given in that method explaination.
Here you can compare the object is which kind of class, and accordingly you can perform your operation.
For that you can pass your self reference to Controller3 every time and you can store it with id type.
Hope this will help you in your code.