diff options
author | Julian Rex <julian.rex@gmail.com> | 2018-11-20 10:26:09 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-20 10:26:09 -0500 |
commit | 90f609ca8fe92f89374a7c1438511cde0f72195a (patch) | |
tree | 575483facd4204f0da290a5c37da620107737f18 /platform/darwin/src/MGLStyle.mm | |
parent | 9ac444a08d9701dc7b0da41859842a77d7be8e00 (diff) | |
download | qtlocation-mapboxgl-90f609ca8fe92f89374a7c1438511cde0f72195a.tar.gz |
[ios, macos] Added `-(BOOL)[MGLStyle removeSource:error:]` that provides an NSError. (#13399)
Diffstat (limited to 'platform/darwin/src/MGLStyle.mm')
-rw-r--r-- | platform/darwin/src/MGLStyle.mm | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/platform/darwin/src/MGLStyle.mm b/platform/darwin/src/MGLStyle.mm index 4c98fd332b..244d09ea14 100644 --- a/platform/darwin/src/MGLStyle.mm +++ b/platform/darwin/src/MGLStyle.mm @@ -219,16 +219,23 @@ static_assert(6 == mbgl::util::default_styles::numOrderedStyles, - (void)removeSource:(MGLSource *)source { + [self removeSource:source error:nil]; +} + +- (BOOL)removeSource:(MGLSource *)source error:(NSError * __nullable * __nullable)outError { MGLLogDebug(@"Removing source: %@", source); + if (!source.rawSource) { [NSException raise:NSInvalidArgumentException format: @"The source %@ cannot be removed from the style. " @"Make sure the source was created as a member of a concrete subclass of MGLSource.", source]; } - [source removeFromMapView:self.mapView]; + + return [source removeFromMapView:self.mapView error:outError]; } + - (nullable NSArray<MGLAttributionInfo *> *)attributionInfosWithFontSize:(CGFloat)fontSize linkColor:(nullable MGLColor *)linkColor { // It’d be incredibly convenient to use -sources here, but this operation // depends on the sources being sorted in ascending order by creation, as |