Reputation: 6997
Prefixing a variable declared outside of any scope with the keyword static prevents that variable from being externally accessible. However, does it limit the scope from a category using it?
Foo.m
@implementation Foo
static void* FooContext = &FooContext;
- (void)methodThatUsesFooContext { ... }
@end
Foo+SpecialSauce.h
@implementation Foo (Special Sauce)
- (void)anotherMethodThatWouldLikeToUseFooContext { ... }
@end
Upvotes: 1
Views: 307
Reputation: 410732
Static variables declared at the top-level of a file (i.e., outside of any functions or method calls) are visible to anything within that file.
Upvotes: 1