0

i'm new to iOS programming and its difficult to understand the difference about instance variable. I post you two example, could you explain me what is the difference? (only for instance variable that are not IBOutlet).

in .m file

@interface MyClass ()
  @property(nonatomic, strong) NSString *aString;
@end

in .m file

@implementation MyClass
{
   NSString *_aString;
}

In both cases i'm on .m file and i'm declaring "instance" variable. But, what is the difference of declaring them in @interface ( .m file ) and in @implementation with {} ?

I have excluded IBOutlet because there are in @interface only (i guess...)

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Mistre83
  • 2,677
  • 6
  • 40
  • 77

1 Answers1

0

The @interface variable is called a property - thus the @property.

Check out this source to find out the difference:

Difference between properties and variables

Community
  • 1
  • 1
Wyetro
  • 8,439
  • 9
  • 46
  • 64