0
@interface TestViewController ()
{
    NSString *a;
}
@end

@implementation TestViewController
{
    NSString *b;
}

Seems like *a and *b are the same, both are private global variables in this file.
Can anyone tell me there difference?

user1900556
  • 109
  • 1
  • 1
  • 5

2 Answers2

2

Both are instance variables, not global variables, but otherwise the two declaration methods are the same. Being able to declare instance variables in the @implementation is a more recent feature of Objective-C and is the better location - instance variables are part of the implementation of a class and (generally) not part of the (public) interface.

CRD
  • 52,522
  • 5
  • 70
  • 86
0

@properties declared in Class Extension in not visible in other classes.

Pandey_Laxman
  • 3,889
  • 2
  • 21
  • 39