title: How to access a variable from inner class
body: <pre><code> //MainClass.m 
  
   @interface InnerClass : NSObject{
  
   }
   @end
  
   @implementation InnerClass
  
   -(void)run{
        while(isActive){//want to access this variable which defined in MainClass
        //do something
        }
   }
  
   @end
  
   @interface MainClass : NSObject{
        BOOL isActive;
   }
   @end
  
   @implementation MainClass
  
  
   @end
  </code></pre>
  
  <p>I have MainClass and it has an inner class (InnerClass). I want to access the boolean type variable (isActive) defined in MainClass class from the inner class. What I am trying to do is that the inner class will run on a separate thread and will keep checking the isActive variable on the main class and if isActive is false then it will stop running the new thread.. Thanks in advance...</p>