kumowoon1025
kumowoon1025

Reputation: 211

Why are IBOutlet Properties declared in a class extension?

When I create a new single view application, the UIViewController file that is generated has an extension (I think it's an extension) in the implementation file.

//
//  ViewController.m
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

//...

@end

And the convention seems to be that IBOutlets are declared as properties inside this extension. Why is this? What kind of behavior does this result in that is different from declaring it in the header file interface?

Upvotes: 0

Views: 401

Answers (1)

Adriano
Adriano

Reputation: 526

Properties in the header files are public, property declarations in the implementation files are private. It's up to you to choose. You can connect them directly from the interface builder into the desired file. I can't understand your concern about extension - this code is fine. Could you explain this? (i can't comment - too less reputation, sorry)

Upvotes: 2

Related Questions