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:
David Rodrigues
2016-08-05 03:00:46 +01:00
committed by Adlai Holler
parent 01c8dc3dc2
commit 70574243f7
14 changed files with 69 additions and 61 deletions

View File

@@ -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