2

/* Variable declared in @interface of .m file */

@interface ClassA () {
    NSMutableArray *mDocuments;
}

/* Variable declared in @implementation of .m file */

@implementation ClassA () {
    NSMutableArray *mDocuments;
}

1 Answers1

2

Declaring a variable in @interface is so it can be seen by other files, so a public declaration.

Declaring a variable in @implementation is private to the file.

See this thread for more in-depth: Private ivar in @interface or @implementation

Community
  • 1
  • 1
David P
  • 617
  • 1
  • 15
  • 26
  • Is this visible, even if I declare in `@interface` of **.m** file? – Thangaraj Ramasamy Feb 16 '14 at 04:03
  • It will be visible in ClassA in either location. You should put it in `@implementation` unless you have a reason for it to be public. (In my experience, I've never declared in @interface, only in the .h file). – David P Feb 16 '14 at 04:06