objective c - How do create a global method in iOS? -
I use a POST request for a URL, parsing JSON and doing many useful things, I am trying to do Unfortunately I need to use it multiple times in multiple view controllers, what would be the best way to do this? I have found a working solution for variables (global variables used in each VC). Looks like .m file: #import "DataClass.h" @ Implementation DataClash synthesis string; @ Synthesis credit; @ Synthesis point; @ Synthesis global name; @Synthesis questionsCount; @ Synthesis wrong questions; @check the exact question; Fixed dataclass * instance = zero; + (DataClass *) getInstance {@synchronized (self) {if (example == zero) {example = [dataclass new]; }} Return example; } And every time I call the using a variable using the GetInstance method / modify the data class object. This method now receives some NSString parameters and also returns an NSString. So my question is .. Can I use the same class to make my call poststral method global and available for every VC...