summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2015-05-14 14:49:26 -0700
committerMinh Nguyễn <mxn@1ec5.org>2015-05-14 14:49:26 -0700
commit00b2e13b64afd7eb0fde1e60db7ca75cafe85469 (patch)
treecbb51a801ea47ef52802a84229f7239ce1910ded /platform
parent594603f929da1d3a620ab2e69207793ed3e42bdd (diff)
downloadqtlocation-mapboxgl-00b2e13b64afd7eb0fde1e60db7ca75cafe85469.tar.gz
mapID → styleID
Deprecated `-mapID` and `-setMapID:` to accurately reflect the APIs the ID is used for. Marked the property unavailable but reimplemented its getter and setter to assert with helpful messages. Fixes #1500.
Diffstat (limited to 'platform')
-rw-r--r--platform/ios/MGLMapView.mm26
1 files changed, 15 insertions, 11 deletions
diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm
index ff31ec9e1a..b488d01f61 100644
--- a/platform/ios/MGLMapView.mm
+++ b/platform/ios/MGLMapView.mm
@@ -162,7 +162,7 @@ std::chrono::steady_clock::duration secondsAsDuration(float duration)
+ (NSSet *)keyPathsForValuesAffectingStyleURL
{
- return [NSSet setWithObjects:@"mapID", @"accessToken", nil];
+ return [NSSet setWithObjects:@"styleID", @"accessToken", nil];
}
- (NSURL *)styleURL
@@ -1543,27 +1543,31 @@ CLLocationCoordinate2D latLngToCoordinate(mbgl::LatLng latLng)
return [NSArray arrayWithArray:_bundledStyleURLs];
}
-+ (NSSet *)keyPathsForValuesAffectingMapID
++ (NSSet *)keyPathsForValuesAffectingStyleID
{
return [NSSet setWithObjects:@"styleURL", @"accessToken", nil];
}
-- (NSString *)mapID
+- (NSString *)styleID
{
NSURL *styleURL = self.styleURL;
return [styleURL.scheme isEqualToString:@"mapbox"] ? styleURL.host.mgl_stringOrNilIfEmpty : nil;
}
+- (void)setStyleID:(NSString *)styleID
+{
+ self.styleURL = styleID ? [NSURL URLWithString:[NSString stringWithFormat:@"mapbox://%@", styleID]] : nil;
+}
+
+- (NSString *)mapID
+{
+ NSAssert(NO, @"-[MGLMapView mapID] has been renamed -[MGLMapView styleID].");
+ return nil;
+}
+
- (void)setMapID:(NSString *)mapID
{
- if (mapID)
- {
- self.styleURL = [NSURL URLWithString:[NSString stringWithFormat:@"mapbox://%@", mapID]];
- }
- else
- {
- self.styleURL = nil;
- }
+ NSAssert(NO, @"-[MGLMapView setMapID:] has been renamed -[MGLMapView setStyleID:].\n\nIf you previously set this map ID in a storyboard inspectable, select the MGLMapView in Interface Builder and delete the “mapID” entry from the User Defined Runtime Attributes section of the Identity inspector. Then go to the Attributes inspector and enter “%@” into the “Style ID” field.", mapID);
}
- (NSArray *)styleClasses