diff options
Diffstat (limited to 'platform/darwin/src/MGLFoundation_Private.h')
-rw-r--r-- | platform/darwin/src/MGLFoundation_Private.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLFoundation_Private.h b/platform/darwin/src/MGLFoundation_Private.h index f231628756..71737c2cf9 100644 --- a/platform/darwin/src/MGLFoundation_Private.h +++ b/platform/darwin/src/MGLFoundation_Private.h @@ -3,3 +3,11 @@ #include <mbgl/util/run_loop.hpp> void MGLInitializeRunLoop(); + +/* Using a compound statement (GNU Extension, supported by clang) */ +#define MGL_OBJC_DYNAMIC_CAST(object, type) \ + ({ \ + __typeof__( object ) temp##__LINE__ = (object); \ + (type *)([temp##__LINE__ isKindOfClass:[type class]] ? temp##__LINE__ : nil); \ + }) + |