tgma4stuff
tgma4stuff

Reputation: 31

IBAction methods in class extensions?

Is it good programming practice to define all (IBAction) methods associated with a NSViewController's .xib within a class extension?

Upvotes: 3

Views: 1478

Answers (2)

ybakos
ybakos

Reputation: 8630

There's no reason to declare the IBAction in the class extension, if the intent is merely to make the IBAction method private. Just add the implementation of the action method in the controller @implementation.

Upvotes: 1

gcamp
gcamp

Reputation: 14662

Everything that's in the class extension is private to your class.

So the real question here is your IBAction here is private to your view controller or not. If that's something used internally, like the press of a button to activate a function inside your view controller, then yes, put it in your class extension.

Upvotes: 1

Related Questions