diff options
Diffstat (limited to 'platform/darwin/src/MGLSource_Private.h')
-rw-r--r-- | platform/darwin/src/MGLSource_Private.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLSource_Private.h b/platform/darwin/src/MGLSource_Private.h index af14c11b90..4a7c31694d 100644 --- a/platform/darwin/src/MGLSource_Private.h +++ b/platform/darwin/src/MGLSource_Private.h @@ -2,6 +2,7 @@ #include <memory> + NS_ASSUME_NONNULL_BEGIN namespace mbgl { @@ -18,6 +19,20 @@ struct SourceWrapper { __weak MGLSource *source; }; +/** + Assert that the style source is valid. + + This macro should be used at the beginning of any public-facing instance method + of `MGLSource` and its subclasses. For private methods, an assertion is more appropriate. + */ +#define MGLAssertStyleSourceIsValid() \ +do { \ + if (!self.rawSource) { \ + [NSException raise:MGLInvalidStyleSourceException \ + format:@"This source got invalidated after the style change"]; \ + } \ +} while (NO); + @class MGLMapView; @interface MGLSource (Private) |