objc之method&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

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-15
  • 2021-10-05
  • 2022-01-21
  • 2021-09-30
  • 2021-08-13
猜你喜欢
  • 2022-03-05
  • 2021-11-03
  • 2022-12-23
  • 2021-12-29
  • 2021-03-31
  • 2021-04-12
  • 2021-11-25
相关资源
相似解决方案