中文难以表达原著的意思
Method and Class Attributes
Objective-C now supports some gcc attributes for Objective-C methods. Syntactically, attributes for a method follow the method's declaration, and attributes for a method parameter sit between the parameter type and the parameter name. Supported attributes include:
-
Deprecation and availability, including AvailabilityMacros.h
- (void)method:(id)param __attribute__((deprecated));
-
Unused parameters
- (void)method:(id) __attribute__((unused)) param;
-
Sentinel parameters, including
NS_REQUIRES_NIL_TERMINATION- (void)methodWithObjects:(id)obj, ... NS_REQUIRES_NIL_TERMINATION;
Objective-C also supports some gcc attributes for Objective-C classes. Syntactically, attributes for a class precede the class's @interface declaration. Supported attributes include:
-
Deprecation and availability, including AvailabilityMacros.h
__attribute__((deprecated))
@interface MyDeprecatedClass : SomeSuperclass
-
Visibility
__attribute__((visibility("hidden")))@interface MyPrivateClass : SomeSuperclass
@package Instance Variables
@package is a new instance variable protection class, like @public and @protected . @package instance variables behave as follows:
-
@publicin 32-bit; -
@publicin 64-bit, inside the framework that defined the class; -
@privatein 64-bit, outside the framework that defined the class.
In 64-bit, the instance variable symbol for an @package ivar is not exported, so any attempt to use the ivar from outside the framework that defined the class will fail with a link error. See "“64-bit Class and Instance Variable Access Control” " for more about instance variable symbols.

1万+

被折叠的 条评论
为什么被折叠?



