Method Construction and Call This is the structure of a method defined within a class and how to correctly reference it when calling the method in another class.
//Method Contruction and Call
//1. Define the method in the .h file of the class
@interface UDAUtilities : NSObject
+(void)trackScreenName:(NSString *)screenName;
@end
//2. Define it in the .m file of the class
+ (void)trackScreenName:(NSString *)screenName {
NSString *eventName = [NSString stringWithFormat:@"%@:PageView:%@", [self deviceIdiomString], screenName];
NSLog(@"%@", eventName);
//3. Later in the code... Called elsewhere
// Class that intends to use a method of another class must use import statement in the *.h
// If passing in a named property, it must also be defined in the header class
//*.h
#import "UDAUtilities.h"
[…]
@property (nonatomic, strong) NSString *screenName;
// *.m
If (self.screenName) {
[UDAUtilities trackScreenName: self.screenName];
}