@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?
@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?
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.
@properties declared in Class Extension in not visible in other classes.