I need to create an NSString, so I can set its value in one class and get it in another. How can I do it?
if you write:
NSString *globalString = @"someString";
anywhere outside a method, class definition, function, etc... it will be able to be referenced anywhere. (it is global!)
The file that accesses it will declare it as external
extern NSString *globalString;
This declaration signifies that it is being accessed from another file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With