Question

I have seen dozens of people using declarations like this in their implementation files:

@interface ViewController ()<UIPickerViewDataSource,UIPickerViewDelegate>

@implementation ViewController
{
  UIPopoverController *popoverController;
      NSString *currentPick;
    ….
}

Is it a good way or shall I define properties in the class extenion like this:

@interface ViewController ()
{
  @property (nonatomic, strong) UIPopoverController *popoverController;
  @property (nonatomic, strong) NSString *currentPick;
    ….
}
@implementation ViewController
@synthesize popoverController;
@synthesize currentPick;
...

I'm a lit a bit confused in this case.

Thanks in advance.

Was it helpful?

Solution

Property vs Instance Variable

The best way is to declare properties within your class extensions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top