Reputation: 20746
I wonder is there any difference between the following code:
First
@implementation ViewController {
AAShareBubbles *shareBubbles;
}
// methods' implementations
@end
Second
@implementation ViewController
AAShareBubbles *shareBubbles;
// methods' implementations
@end
Which one do you prefer and why?
Upvotes: 1
Views: 46
Reputation: 36
First one: it's an instance variable.
Second one: it's a variable inside your implementation scope, you cannot use as an instance variable.
So they're different. P/S: I've never used the second one.
Upvotes: 2
Reputation: 5148
First code define Objective-C internal variable, so you can use inside of current implement.
Second define a private global variable in C style. If the same variable name is existed in two or more class this will case of runtime error like following image
Upvotes: 0