How to use a variable definition that is defined in different class inside a method

I have the following code in the main view controller class:


-(void) onPip/analyzerOutputEventForPipID:(PipID) pipID

{

Pip *pip = [[pipManager ShareManager] getPipWithPipID:pipID];


AnalyzerOutput *sample = [pip.analyzerOutput objectAtIndex:SAOutputConductance];


RawData.text = [NSString stringWithFormat:@"%f", sample.value];


float GSRCalc1 = sample.value;


}


I need to reference GSRCalc1 in a different class that I am using to make a line graph of the raw data and I need it to still eqaul sample.value. How do I do that?

Hi MaxBio!


You would need to import your viewcontroller.swift file into your new class.


For example:


mySecondClass.swift

#import "myFirstClass.swift"

or you could also use:

@class myFirstClass;


EDIT:

Now realizing that you posted this in the Objective-C forum and not the Swift forum, here is the correct code you should use:

mySecondClass.h

#import "myFirstClass.h"
// - OR - 
@class myFirstClass;

//----------------
mySecondClass.m

//You will also need to import into your implememntation if you plan on using it there. Use:
#import "myFirstClass.h"

//Side Note:
//If your class is part of a framework, you can use:
#import <myFramework/myFirstClass.h>

Hope that helps!

How to use a variable definition that is defined in different class inside a method
 
 
Q