mirror of
https://github.com/HackPlan/AsyncDisplayKit.git
synced 2026-04-24 03:45:58 +08:00
Prevent API misuse at compile time (#2035)
Using Objective-C attributes, in this case `unavailable`, we can hide unsupported APIs at compile time instead of detecting and warn about it at runtime with a set of asserts.
This commit is contained in:
committed by
Adlai Holler
parent
01c8dc3dc2
commit
70574243f7
@@ -143,3 +143,11 @@
|
||||
#define ASDISPLAYNODE_REQUIRES_SUPER
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef AS_UNAVAILABLE
|
||||
#if __has_attribute(unavailable)
|
||||
#define AS_UNAVAILABLE(message) __attribute__((unavailable(message)))
|
||||
#else
|
||||
#define AS_UNAVAILABLE(message)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user